{-# 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.ListContacts
-- 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)
--
-- Returns a list of contacts.
--
-- If @statusList@ contains AVAILABLE, the request must include
-- @groundStation@, @missionprofileArn@, and @satelliteArn@.
--
-- This operation returns paginated results.
module Amazonka.GroundStation.ListContacts
  ( -- * Creating a Request
    ListContacts (..),
    newListContacts,

    -- * Request Lenses
    listContacts_missionProfileArn,
    listContacts_satelliteArn,
    listContacts_nextToken,
    listContacts_groundStation,
    listContacts_maxResults,
    listContacts_endTime,
    listContacts_startTime,
    listContacts_statusList,

    -- * Destructuring the Response
    ListContactsResponse (..),
    newListContactsResponse,

    -- * Response Lenses
    listContactsResponse_contactList,
    listContactsResponse_nextToken,
    listContactsResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newListContacts' smart constructor.
data ListContacts = ListContacts'
  { -- | ARN of a mission profile.
    ListContacts -> Maybe Text
missionProfileArn :: Prelude.Maybe Prelude.Text,
    -- | ARN of a satellite.
    ListContacts -> Maybe Text
satelliteArn :: Prelude.Maybe Prelude.Text,
    -- | Next token returned in the request of a previous @ListContacts@ call.
    -- Used to get the next page of results.
    ListContacts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Name of a ground station.
    ListContacts -> Maybe Text
groundStation :: Prelude.Maybe Prelude.Text,
    -- | Maximum number of contacts returned.
    ListContacts -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | End time of a contact.
    ListContacts -> POSIX
endTime :: Core.POSIX,
    -- | Start time of a contact.
    ListContacts -> POSIX
startTime :: Core.POSIX,
    -- | Status of a contact reservation.
    ListContacts -> [ContactStatus]
statusList :: [ContactStatus]
  }
  deriving (ListContacts -> ListContacts -> Bool
(ListContacts -> ListContacts -> Bool)
-> (ListContacts -> ListContacts -> Bool) -> Eq ListContacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContacts -> ListContacts -> Bool
$c/= :: ListContacts -> ListContacts -> Bool
== :: ListContacts -> ListContacts -> Bool
$c== :: ListContacts -> ListContacts -> Bool
Prelude.Eq, ReadPrec [ListContacts]
ReadPrec ListContacts
Int -> ReadS ListContacts
ReadS [ListContacts]
(Int -> ReadS ListContacts)
-> ReadS [ListContacts]
-> ReadPrec ListContacts
-> ReadPrec [ListContacts]
-> Read ListContacts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContacts]
$creadListPrec :: ReadPrec [ListContacts]
readPrec :: ReadPrec ListContacts
$creadPrec :: ReadPrec ListContacts
readList :: ReadS [ListContacts]
$creadList :: ReadS [ListContacts]
readsPrec :: Int -> ReadS ListContacts
$creadsPrec :: Int -> ReadS ListContacts
Prelude.Read, Int -> ListContacts -> ShowS
[ListContacts] -> ShowS
ListContacts -> String
(Int -> ListContacts -> ShowS)
-> (ListContacts -> String)
-> ([ListContacts] -> ShowS)
-> Show ListContacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContacts] -> ShowS
$cshowList :: [ListContacts] -> ShowS
show :: ListContacts -> String
$cshow :: ListContacts -> String
showsPrec :: Int -> ListContacts -> ShowS
$cshowsPrec :: Int -> ListContacts -> ShowS
Prelude.Show, (forall x. ListContacts -> Rep ListContacts x)
-> (forall x. Rep ListContacts x -> ListContacts)
-> Generic ListContacts
forall x. Rep ListContacts x -> ListContacts
forall x. ListContacts -> Rep ListContacts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContacts x -> ListContacts
$cfrom :: forall x. ListContacts -> Rep ListContacts x
Prelude.Generic)

-- |
-- Create a value of 'ListContacts' 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:
--
-- 'missionProfileArn', 'listContacts_missionProfileArn' - ARN of a mission profile.
--
-- 'satelliteArn', 'listContacts_satelliteArn' - ARN of a satellite.
--
-- 'nextToken', 'listContacts_nextToken' - Next token returned in the request of a previous @ListContacts@ call.
-- Used to get the next page of results.
--
-- 'groundStation', 'listContacts_groundStation' - Name of a ground station.
--
-- 'maxResults', 'listContacts_maxResults' - Maximum number of contacts returned.
--
-- 'endTime', 'listContacts_endTime' - End time of a contact.
--
-- 'startTime', 'listContacts_startTime' - Start time of a contact.
--
-- 'statusList', 'listContacts_statusList' - Status of a contact reservation.
newListContacts ::
  -- | 'endTime'
  Prelude.UTCTime ->
  -- | 'startTime'
  Prelude.UTCTime ->
  ListContacts
newListContacts :: UTCTime -> UTCTime -> ListContacts
newListContacts UTCTime
pEndTime_ UTCTime
pStartTime_ =
  ListContacts' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> POSIX
-> POSIX
-> [ContactStatus]
-> ListContacts
ListContacts'
    { $sel:missionProfileArn:ListContacts' :: Maybe Text
missionProfileArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:satelliteArn:ListContacts' :: Maybe Text
satelliteArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListContacts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:groundStation:ListContacts' :: Maybe Text
groundStation = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListContacts' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:ListContacts' :: POSIX
endTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pEndTime_,
      $sel:startTime:ListContacts' :: POSIX
startTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pStartTime_,
      $sel:statusList:ListContacts' :: [ContactStatus]
statusList = [ContactStatus]
forall a. Monoid a => a
Prelude.mempty
    }

-- | ARN of a mission profile.
listContacts_missionProfileArn :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Text)
listContacts_missionProfileArn :: (Maybe Text -> f (Maybe Text)) -> ListContacts -> f ListContacts
listContacts_missionProfileArn = (ListContacts -> Maybe Text)
-> (ListContacts -> Maybe Text -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Text
missionProfileArn :: Maybe Text
$sel:missionProfileArn:ListContacts' :: ListContacts -> Maybe Text
missionProfileArn} -> Maybe Text
missionProfileArn) (\s :: ListContacts
s@ListContacts' {} Maybe Text
a -> ListContacts
s {$sel:missionProfileArn:ListContacts' :: Maybe Text
missionProfileArn = Maybe Text
a} :: ListContacts)

-- | ARN of a satellite.
listContacts_satelliteArn :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Text)
listContacts_satelliteArn :: (Maybe Text -> f (Maybe Text)) -> ListContacts -> f ListContacts
listContacts_satelliteArn = (ListContacts -> Maybe Text)
-> (ListContacts -> Maybe Text -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Text
satelliteArn :: Maybe Text
$sel:satelliteArn:ListContacts' :: ListContacts -> Maybe Text
satelliteArn} -> Maybe Text
satelliteArn) (\s :: ListContacts
s@ListContacts' {} Maybe Text
a -> ListContacts
s {$sel:satelliteArn:ListContacts' :: Maybe Text
satelliteArn = Maybe Text
a} :: ListContacts)

-- | Next token returned in the request of a previous @ListContacts@ call.
-- Used to get the next page of results.
listContacts_nextToken :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Text)
listContacts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListContacts -> f ListContacts
listContacts_nextToken = (ListContacts -> Maybe Text)
-> (ListContacts -> Maybe Text -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContacts' :: ListContacts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContacts
s@ListContacts' {} Maybe Text
a -> ListContacts
s {$sel:nextToken:ListContacts' :: Maybe Text
nextToken = Maybe Text
a} :: ListContacts)

-- | Name of a ground station.
listContacts_groundStation :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Text)
listContacts_groundStation :: (Maybe Text -> f (Maybe Text)) -> ListContacts -> f ListContacts
listContacts_groundStation = (ListContacts -> Maybe Text)
-> (ListContacts -> Maybe Text -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Text
groundStation :: Maybe Text
$sel:groundStation:ListContacts' :: ListContacts -> Maybe Text
groundStation} -> Maybe Text
groundStation) (\s :: ListContacts
s@ListContacts' {} Maybe Text
a -> ListContacts
s {$sel:groundStation:ListContacts' :: Maybe Text
groundStation = Maybe Text
a} :: ListContacts)

-- | Maximum number of contacts returned.
listContacts_maxResults :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Int)
listContacts_maxResults :: (Maybe Int -> f (Maybe Int)) -> ListContacts -> f ListContacts
listContacts_maxResults = (ListContacts -> Maybe Int)
-> (ListContacts -> Maybe Int -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListContacts' :: ListContacts -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListContacts
s@ListContacts' {} Maybe Int
a -> ListContacts
s {$sel:maxResults:ListContacts' :: Maybe Int
maxResults = Maybe Int
a} :: ListContacts)

-- | End time of a contact.
listContacts_endTime :: Lens.Lens' ListContacts Prelude.UTCTime
listContacts_endTime :: (UTCTime -> f UTCTime) -> ListContacts -> f ListContacts
listContacts_endTime = (ListContacts -> POSIX)
-> (ListContacts -> POSIX -> ListContacts)
-> Lens ListContacts ListContacts POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {POSIX
endTime :: POSIX
$sel:endTime:ListContacts' :: ListContacts -> POSIX
endTime} -> POSIX
endTime) (\s :: ListContacts
s@ListContacts' {} POSIX
a -> ListContacts
s {$sel:endTime:ListContacts' :: POSIX
endTime = POSIX
a} :: ListContacts) ((POSIX -> f POSIX) -> ListContacts -> f ListContacts)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListContacts
-> f ListContacts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Start time of a contact.
listContacts_startTime :: Lens.Lens' ListContacts Prelude.UTCTime
listContacts_startTime :: (UTCTime -> f UTCTime) -> ListContacts -> f ListContacts
listContacts_startTime = (ListContacts -> POSIX)
-> (ListContacts -> POSIX -> ListContacts)
-> Lens ListContacts ListContacts POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {POSIX
startTime :: POSIX
$sel:startTime:ListContacts' :: ListContacts -> POSIX
startTime} -> POSIX
startTime) (\s :: ListContacts
s@ListContacts' {} POSIX
a -> ListContacts
s {$sel:startTime:ListContacts' :: POSIX
startTime = POSIX
a} :: ListContacts) ((POSIX -> f POSIX) -> ListContacts -> f ListContacts)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> ListContacts
-> f ListContacts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Status of a contact reservation.
listContacts_statusList :: Lens.Lens' ListContacts [ContactStatus]
listContacts_statusList :: ([ContactStatus] -> f [ContactStatus])
-> ListContacts -> f ListContacts
listContacts_statusList = (ListContacts -> [ContactStatus])
-> (ListContacts -> [ContactStatus] -> ListContacts)
-> Lens ListContacts ListContacts [ContactStatus] [ContactStatus]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {[ContactStatus]
statusList :: [ContactStatus]
$sel:statusList:ListContacts' :: ListContacts -> [ContactStatus]
statusList} -> [ContactStatus]
statusList) (\s :: ListContacts
s@ListContacts' {} [ContactStatus]
a -> ListContacts
s {$sel:statusList:ListContacts' :: [ContactStatus]
statusList = [ContactStatus]
a} :: ListContacts) (([ContactStatus] -> f [ContactStatus])
 -> ListContacts -> f ListContacts)
-> (([ContactStatus] -> f [ContactStatus])
    -> [ContactStatus] -> f [ContactStatus])
-> ([ContactStatus] -> f [ContactStatus])
-> ListContacts
-> f ListContacts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ContactStatus] -> f [ContactStatus])
-> [ContactStatus] -> f [ContactStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListContacts

instance Core.ToHeaders ListContacts where
  toHeaders :: ListContacts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListContacts -> 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.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListContacts where
  toJSON :: ListContacts -> Value
toJSON ListContacts' {[ContactStatus]
Maybe Int
Maybe Text
POSIX
statusList :: [ContactStatus]
startTime :: POSIX
endTime :: POSIX
maxResults :: Maybe Int
groundStation :: Maybe Text
nextToken :: Maybe Text
satelliteArn :: Maybe Text
missionProfileArn :: Maybe Text
$sel:statusList:ListContacts' :: ListContacts -> [ContactStatus]
$sel:startTime:ListContacts' :: ListContacts -> POSIX
$sel:endTime:ListContacts' :: ListContacts -> POSIX
$sel:maxResults:ListContacts' :: ListContacts -> Maybe Int
$sel:groundStation:ListContacts' :: ListContacts -> Maybe Text
$sel:nextToken:ListContacts' :: ListContacts -> Maybe Text
$sel:satelliteArn:ListContacts' :: ListContacts -> Maybe Text
$sel:missionProfileArn:ListContacts' :: ListContacts -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"missionProfileArn" 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
missionProfileArn,
            (Text
"satelliteArn" 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
satelliteArn,
            (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
"groundStation" 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
groundStation,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"endTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
endTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"startTime" Text -> POSIX -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= POSIX
startTime),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"statusList" Text -> [ContactStatus] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [ContactStatus]
statusList)
          ]
      )

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

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

-- |
--
-- /See:/ 'newListContactsResponse' smart constructor.
data ListContactsResponse = ListContactsResponse'
  { -- | List of contacts.
    ListContactsResponse -> Maybe [ContactData]
contactList :: Prelude.Maybe [ContactData],
    -- | Next token returned in the response of a previous @ListContacts@ call.
    -- Used to get the next page of results.
    ListContactsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListContactsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListContactsResponse -> ListContactsResponse -> Bool
(ListContactsResponse -> ListContactsResponse -> Bool)
-> (ListContactsResponse -> ListContactsResponse -> Bool)
-> Eq ListContactsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContactsResponse -> ListContactsResponse -> Bool
$c/= :: ListContactsResponse -> ListContactsResponse -> Bool
== :: ListContactsResponse -> ListContactsResponse -> Bool
$c== :: ListContactsResponse -> ListContactsResponse -> Bool
Prelude.Eq, ReadPrec [ListContactsResponse]
ReadPrec ListContactsResponse
Int -> ReadS ListContactsResponse
ReadS [ListContactsResponse]
(Int -> ReadS ListContactsResponse)
-> ReadS [ListContactsResponse]
-> ReadPrec ListContactsResponse
-> ReadPrec [ListContactsResponse]
-> Read ListContactsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContactsResponse]
$creadListPrec :: ReadPrec [ListContactsResponse]
readPrec :: ReadPrec ListContactsResponse
$creadPrec :: ReadPrec ListContactsResponse
readList :: ReadS [ListContactsResponse]
$creadList :: ReadS [ListContactsResponse]
readsPrec :: Int -> ReadS ListContactsResponse
$creadsPrec :: Int -> ReadS ListContactsResponse
Prelude.Read, Int -> ListContactsResponse -> ShowS
[ListContactsResponse] -> ShowS
ListContactsResponse -> String
(Int -> ListContactsResponse -> ShowS)
-> (ListContactsResponse -> String)
-> ([ListContactsResponse] -> ShowS)
-> Show ListContactsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContactsResponse] -> ShowS
$cshowList :: [ListContactsResponse] -> ShowS
show :: ListContactsResponse -> String
$cshow :: ListContactsResponse -> String
showsPrec :: Int -> ListContactsResponse -> ShowS
$cshowsPrec :: Int -> ListContactsResponse -> ShowS
Prelude.Show, (forall x. ListContactsResponse -> Rep ListContactsResponse x)
-> (forall x. Rep ListContactsResponse x -> ListContactsResponse)
-> Generic ListContactsResponse
forall x. Rep ListContactsResponse x -> ListContactsResponse
forall x. ListContactsResponse -> Rep ListContactsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContactsResponse x -> ListContactsResponse
$cfrom :: forall x. ListContactsResponse -> Rep ListContactsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListContactsResponse' 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:
--
-- 'contactList', 'listContactsResponse_contactList' - List of contacts.
--
-- 'nextToken', 'listContactsResponse_nextToken' - Next token returned in the response of a previous @ListContacts@ call.
-- Used to get the next page of results.
--
-- 'httpStatus', 'listContactsResponse_httpStatus' - The response's http status code.
newListContactsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListContactsResponse
newListContactsResponse :: Int -> ListContactsResponse
newListContactsResponse Int
pHttpStatus_ =
  ListContactsResponse' :: Maybe [ContactData] -> Maybe Text -> Int -> ListContactsResponse
ListContactsResponse'
    { $sel:contactList:ListContactsResponse' :: Maybe [ContactData]
contactList =
        Maybe [ContactData]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListContactsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListContactsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | List of contacts.
listContactsResponse_contactList :: Lens.Lens' ListContactsResponse (Prelude.Maybe [ContactData])
listContactsResponse_contactList :: (Maybe [ContactData] -> f (Maybe [ContactData]))
-> ListContactsResponse -> f ListContactsResponse
listContactsResponse_contactList = (ListContactsResponse -> Maybe [ContactData])
-> (ListContactsResponse
    -> Maybe [ContactData] -> ListContactsResponse)
-> Lens' ListContactsResponse (Maybe [ContactData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContactsResponse' {Maybe [ContactData]
contactList :: Maybe [ContactData]
$sel:contactList:ListContactsResponse' :: ListContactsResponse -> Maybe [ContactData]
contactList} -> Maybe [ContactData]
contactList) (\s :: ListContactsResponse
s@ListContactsResponse' {} Maybe [ContactData]
a -> ListContactsResponse
s {$sel:contactList:ListContactsResponse' :: Maybe [ContactData]
contactList = Maybe [ContactData]
a} :: ListContactsResponse) ((Maybe [ContactData] -> f (Maybe [ContactData]))
 -> ListContactsResponse -> f ListContactsResponse)
-> ((Maybe [ContactData] -> f (Maybe [ContactData]))
    -> Maybe [ContactData] -> f (Maybe [ContactData]))
-> (Maybe [ContactData] -> f (Maybe [ContactData]))
-> ListContactsResponse
-> f ListContactsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ContactData] [ContactData] [ContactData] [ContactData]
-> Iso
     (Maybe [ContactData])
     (Maybe [ContactData])
     (Maybe [ContactData])
     (Maybe [ContactData])
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 [ContactData] [ContactData] [ContactData] [ContactData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Next token returned in the response of a previous @ListContacts@ call.
-- Used to get the next page of results.
listContactsResponse_nextToken :: Lens.Lens' ListContactsResponse (Prelude.Maybe Prelude.Text)
listContactsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListContactsResponse -> f ListContactsResponse
listContactsResponse_nextToken = (ListContactsResponse -> Maybe Text)
-> (ListContactsResponse -> Maybe Text -> ListContactsResponse)
-> Lens' ListContactsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContactsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContactsResponse' :: ListContactsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContactsResponse
s@ListContactsResponse' {} Maybe Text
a -> ListContactsResponse
s {$sel:nextToken:ListContactsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListContactsResponse)

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

instance Prelude.NFData ListContactsResponse