{-# 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.GetSatellite
-- 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 satellite.
module Amazonka.GroundStation.GetSatellite
  ( -- * Creating a Request
    GetSatellite (..),
    newGetSatellite,

    -- * Request Lenses
    getSatellite_satelliteId,

    -- * Destructuring the Response
    GetSatelliteResponse (..),
    newGetSatelliteResponse,

    -- * Response Lenses
    getSatelliteResponse_currentEphemeris,
    getSatelliteResponse_groundStations,
    getSatelliteResponse_noradSatelliteID,
    getSatelliteResponse_satelliteArn,
    getSatelliteResponse_satelliteId,
    getSatelliteResponse_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:/ 'newGetSatellite' smart constructor.
data GetSatellite = GetSatellite'
  { -- | UUID of a satellite.
    GetSatellite -> Text
satelliteId :: Prelude.Text
  }
  deriving (GetSatellite -> GetSatellite -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSatellite -> GetSatellite -> Bool
$c/= :: GetSatellite -> GetSatellite -> Bool
== :: GetSatellite -> GetSatellite -> Bool
$c== :: GetSatellite -> GetSatellite -> Bool
Prelude.Eq, ReadPrec [GetSatellite]
ReadPrec GetSatellite
Int -> ReadS GetSatellite
ReadS [GetSatellite]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSatellite]
$creadListPrec :: ReadPrec [GetSatellite]
readPrec :: ReadPrec GetSatellite
$creadPrec :: ReadPrec GetSatellite
readList :: ReadS [GetSatellite]
$creadList :: ReadS [GetSatellite]
readsPrec :: Int -> ReadS GetSatellite
$creadsPrec :: Int -> ReadS GetSatellite
Prelude.Read, Int -> GetSatellite -> ShowS
[GetSatellite] -> ShowS
GetSatellite -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSatellite] -> ShowS
$cshowList :: [GetSatellite] -> ShowS
show :: GetSatellite -> String
$cshow :: GetSatellite -> String
showsPrec :: Int -> GetSatellite -> ShowS
$cshowsPrec :: Int -> GetSatellite -> ShowS
Prelude.Show, forall x. Rep GetSatellite x -> GetSatellite
forall x. GetSatellite -> Rep GetSatellite x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSatellite x -> GetSatellite
$cfrom :: forall x. GetSatellite -> Rep GetSatellite x
Prelude.Generic)

-- |
-- Create a value of 'GetSatellite' 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:
--
-- 'satelliteId', 'getSatellite_satelliteId' - UUID of a satellite.
newGetSatellite ::
  -- | 'satelliteId'
  Prelude.Text ->
  GetSatellite
newGetSatellite :: Text -> GetSatellite
newGetSatellite Text
pSatelliteId_ =
  GetSatellite' {$sel:satelliteId:GetSatellite' :: Text
satelliteId = Text
pSatelliteId_}

-- | UUID of a satellite.
getSatellite_satelliteId :: Lens.Lens' GetSatellite Prelude.Text
getSatellite_satelliteId :: Lens' GetSatellite Text
getSatellite_satelliteId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSatellite' {Text
satelliteId :: Text
$sel:satelliteId:GetSatellite' :: GetSatellite -> Text
satelliteId} -> Text
satelliteId) (\s :: GetSatellite
s@GetSatellite' {} Text
a -> GetSatellite
s {$sel:satelliteId:GetSatellite' :: Text
satelliteId = Text
a} :: GetSatellite)

instance Core.AWSRequest GetSatellite where
  type AWSResponse GetSatellite = GetSatelliteResponse
  request :: (Service -> Service) -> GetSatellite -> Request GetSatellite
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 GetSatellite
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetSatellite)))
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 EphemerisMetaData
-> Maybe [Text]
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Int
-> GetSatelliteResponse
GetSatelliteResponse'
            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
"currentEphemeris")
            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
"groundStations" 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"noradSatelliteID")
            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
"satelliteArn")
            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
"satelliteId")
            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 GetSatellite where
  hashWithSalt :: Int -> GetSatellite -> Int
hashWithSalt Int
_salt GetSatellite' {Text
satelliteId :: Text
$sel:satelliteId:GetSatellite' :: GetSatellite -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
satelliteId

instance Prelude.NFData GetSatellite where
  rnf :: GetSatellite -> ()
rnf GetSatellite' {Text
satelliteId :: Text
$sel:satelliteId:GetSatellite' :: GetSatellite -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
satelliteId

instance Data.ToHeaders GetSatellite where
  toHeaders :: GetSatellite -> 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 GetSatellite where
  toPath :: GetSatellite -> ByteString
toPath GetSatellite' {Text
satelliteId :: Text
$sel:satelliteId:GetSatellite' :: GetSatellite -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/satellite/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
satelliteId]

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

-- |
--
-- /See:/ 'newGetSatelliteResponse' smart constructor.
data GetSatelliteResponse = GetSatelliteResponse'
  { -- | The current ephemeris being used to compute the trajectory of the
    -- satellite.
    GetSatelliteResponse -> Maybe EphemerisMetaData
currentEphemeris :: Prelude.Maybe EphemerisMetaData,
    -- | A list of ground stations to which the satellite is on-boarded.
    GetSatelliteResponse -> Maybe [Text]
groundStations :: Prelude.Maybe [Prelude.Text],
    -- | NORAD satellite ID number.
    GetSatelliteResponse -> Maybe Natural
noradSatelliteID :: Prelude.Maybe Prelude.Natural,
    -- | ARN of a satellite.
    GetSatelliteResponse -> Maybe Text
satelliteArn :: Prelude.Maybe Prelude.Text,
    -- | UUID of a satellite.
    GetSatelliteResponse -> Maybe Text
satelliteId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetSatelliteResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetSatelliteResponse -> GetSatelliteResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSatelliteResponse -> GetSatelliteResponse -> Bool
$c/= :: GetSatelliteResponse -> GetSatelliteResponse -> Bool
== :: GetSatelliteResponse -> GetSatelliteResponse -> Bool
$c== :: GetSatelliteResponse -> GetSatelliteResponse -> Bool
Prelude.Eq, ReadPrec [GetSatelliteResponse]
ReadPrec GetSatelliteResponse
Int -> ReadS GetSatelliteResponse
ReadS [GetSatelliteResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSatelliteResponse]
$creadListPrec :: ReadPrec [GetSatelliteResponse]
readPrec :: ReadPrec GetSatelliteResponse
$creadPrec :: ReadPrec GetSatelliteResponse
readList :: ReadS [GetSatelliteResponse]
$creadList :: ReadS [GetSatelliteResponse]
readsPrec :: Int -> ReadS GetSatelliteResponse
$creadsPrec :: Int -> ReadS GetSatelliteResponse
Prelude.Read, Int -> GetSatelliteResponse -> ShowS
[GetSatelliteResponse] -> ShowS
GetSatelliteResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSatelliteResponse] -> ShowS
$cshowList :: [GetSatelliteResponse] -> ShowS
show :: GetSatelliteResponse -> String
$cshow :: GetSatelliteResponse -> String
showsPrec :: Int -> GetSatelliteResponse -> ShowS
$cshowsPrec :: Int -> GetSatelliteResponse -> ShowS
Prelude.Show, forall x. Rep GetSatelliteResponse x -> GetSatelliteResponse
forall x. GetSatelliteResponse -> Rep GetSatelliteResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSatelliteResponse x -> GetSatelliteResponse
$cfrom :: forall x. GetSatelliteResponse -> Rep GetSatelliteResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetSatelliteResponse' 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:
--
-- 'currentEphemeris', 'getSatelliteResponse_currentEphemeris' - The current ephemeris being used to compute the trajectory of the
-- satellite.
--
-- 'groundStations', 'getSatelliteResponse_groundStations' - A list of ground stations to which the satellite is on-boarded.
--
-- 'noradSatelliteID', 'getSatelliteResponse_noradSatelliteID' - NORAD satellite ID number.
--
-- 'satelliteArn', 'getSatelliteResponse_satelliteArn' - ARN of a satellite.
--
-- 'satelliteId', 'getSatelliteResponse_satelliteId' - UUID of a satellite.
--
-- 'httpStatus', 'getSatelliteResponse_httpStatus' - The response's http status code.
newGetSatelliteResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetSatelliteResponse
newGetSatelliteResponse :: Int -> GetSatelliteResponse
newGetSatelliteResponse Int
pHttpStatus_ =
  GetSatelliteResponse'
    { $sel:currentEphemeris:GetSatelliteResponse' :: Maybe EphemerisMetaData
currentEphemeris =
        forall a. Maybe a
Prelude.Nothing,
      $sel:groundStations:GetSatelliteResponse' :: Maybe [Text]
groundStations = forall a. Maybe a
Prelude.Nothing,
      $sel:noradSatelliteID:GetSatelliteResponse' :: Maybe Natural
noradSatelliteID = forall a. Maybe a
Prelude.Nothing,
      $sel:satelliteArn:GetSatelliteResponse' :: Maybe Text
satelliteArn = forall a. Maybe a
Prelude.Nothing,
      $sel:satelliteId:GetSatelliteResponse' :: Maybe Text
satelliteId = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetSatelliteResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The current ephemeris being used to compute the trajectory of the
-- satellite.
getSatelliteResponse_currentEphemeris :: Lens.Lens' GetSatelliteResponse (Prelude.Maybe EphemerisMetaData)
getSatelliteResponse_currentEphemeris :: Lens' GetSatelliteResponse (Maybe EphemerisMetaData)
getSatelliteResponse_currentEphemeris = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSatelliteResponse' {Maybe EphemerisMetaData
currentEphemeris :: Maybe EphemerisMetaData
$sel:currentEphemeris:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe EphemerisMetaData
currentEphemeris} -> Maybe EphemerisMetaData
currentEphemeris) (\s :: GetSatelliteResponse
s@GetSatelliteResponse' {} Maybe EphemerisMetaData
a -> GetSatelliteResponse
s {$sel:currentEphemeris:GetSatelliteResponse' :: Maybe EphemerisMetaData
currentEphemeris = Maybe EphemerisMetaData
a} :: GetSatelliteResponse)

-- | A list of ground stations to which the satellite is on-boarded.
getSatelliteResponse_groundStations :: Lens.Lens' GetSatelliteResponse (Prelude.Maybe [Prelude.Text])
getSatelliteResponse_groundStations :: Lens' GetSatelliteResponse (Maybe [Text])
getSatelliteResponse_groundStations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSatelliteResponse' {Maybe [Text]
groundStations :: Maybe [Text]
$sel:groundStations:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe [Text]
groundStations} -> Maybe [Text]
groundStations) (\s :: GetSatelliteResponse
s@GetSatelliteResponse' {} Maybe [Text]
a -> GetSatelliteResponse
s {$sel:groundStations:GetSatelliteResponse' :: Maybe [Text]
groundStations = Maybe [Text]
a} :: GetSatelliteResponse) 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

-- | NORAD satellite ID number.
getSatelliteResponse_noradSatelliteID :: Lens.Lens' GetSatelliteResponse (Prelude.Maybe Prelude.Natural)
getSatelliteResponse_noradSatelliteID :: Lens' GetSatelliteResponse (Maybe Natural)
getSatelliteResponse_noradSatelliteID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSatelliteResponse' {Maybe Natural
noradSatelliteID :: Maybe Natural
$sel:noradSatelliteID:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe Natural
noradSatelliteID} -> Maybe Natural
noradSatelliteID) (\s :: GetSatelliteResponse
s@GetSatelliteResponse' {} Maybe Natural
a -> GetSatelliteResponse
s {$sel:noradSatelliteID:GetSatelliteResponse' :: Maybe Natural
noradSatelliteID = Maybe Natural
a} :: GetSatelliteResponse)

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

-- | UUID of a satellite.
getSatelliteResponse_satelliteId :: Lens.Lens' GetSatelliteResponse (Prelude.Maybe Prelude.Text)
getSatelliteResponse_satelliteId :: Lens' GetSatelliteResponse (Maybe Text)
getSatelliteResponse_satelliteId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSatelliteResponse' {Maybe Text
satelliteId :: Maybe Text
$sel:satelliteId:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe Text
satelliteId} -> Maybe Text
satelliteId) (\s :: GetSatelliteResponse
s@GetSatelliteResponse' {} Maybe Text
a -> GetSatelliteResponse
s {$sel:satelliteId:GetSatelliteResponse' :: Maybe Text
satelliteId = Maybe Text
a} :: GetSatelliteResponse)

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

instance Prelude.NFData GetSatelliteResponse where
  rnf :: GetSatelliteResponse -> ()
rnf GetSatelliteResponse' {Int
Maybe Natural
Maybe [Text]
Maybe Text
Maybe EphemerisMetaData
httpStatus :: Int
satelliteId :: Maybe Text
satelliteArn :: Maybe Text
noradSatelliteID :: Maybe Natural
groundStations :: Maybe [Text]
currentEphemeris :: Maybe EphemerisMetaData
$sel:httpStatus:GetSatelliteResponse' :: GetSatelliteResponse -> Int
$sel:satelliteId:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe Text
$sel:satelliteArn:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe Text
$sel:noradSatelliteID:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe Natural
$sel:groundStations:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe [Text]
$sel:currentEphemeris:GetSatelliteResponse' :: GetSatelliteResponse -> Maybe EphemerisMetaData
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe EphemerisMetaData
currentEphemeris
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
groundStations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
noradSatelliteID
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
satelliteArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
satelliteId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus