{-# 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.Nimble.GetStreamingImage
-- 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)
--
-- Get streaming image.
module Amazonka.Nimble.GetStreamingImage
  ( -- * Creating a Request
    GetStreamingImage (..),
    newGetStreamingImage,

    -- * Request Lenses
    getStreamingImage_studioId,
    getStreamingImage_streamingImageId,

    -- * Destructuring the Response
    GetStreamingImageResponse (..),
    newGetStreamingImageResponse,

    -- * Response Lenses
    getStreamingImageResponse_streamingImage,
    getStreamingImageResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetStreamingImage' smart constructor.
data GetStreamingImage = GetStreamingImage'
  { -- | The studio ID.
    GetStreamingImage -> Text
studioId :: Prelude.Text,
    -- | The streaming image ID.
    GetStreamingImage -> Text
streamingImageId :: Prelude.Text
  }
  deriving (GetStreamingImage -> GetStreamingImage -> Bool
(GetStreamingImage -> GetStreamingImage -> Bool)
-> (GetStreamingImage -> GetStreamingImage -> Bool)
-> Eq GetStreamingImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStreamingImage -> GetStreamingImage -> Bool
$c/= :: GetStreamingImage -> GetStreamingImage -> Bool
== :: GetStreamingImage -> GetStreamingImage -> Bool
$c== :: GetStreamingImage -> GetStreamingImage -> Bool
Prelude.Eq, ReadPrec [GetStreamingImage]
ReadPrec GetStreamingImage
Int -> ReadS GetStreamingImage
ReadS [GetStreamingImage]
(Int -> ReadS GetStreamingImage)
-> ReadS [GetStreamingImage]
-> ReadPrec GetStreamingImage
-> ReadPrec [GetStreamingImage]
-> Read GetStreamingImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStreamingImage]
$creadListPrec :: ReadPrec [GetStreamingImage]
readPrec :: ReadPrec GetStreamingImage
$creadPrec :: ReadPrec GetStreamingImage
readList :: ReadS [GetStreamingImage]
$creadList :: ReadS [GetStreamingImage]
readsPrec :: Int -> ReadS GetStreamingImage
$creadsPrec :: Int -> ReadS GetStreamingImage
Prelude.Read, Int -> GetStreamingImage -> ShowS
[GetStreamingImage] -> ShowS
GetStreamingImage -> String
(Int -> GetStreamingImage -> ShowS)
-> (GetStreamingImage -> String)
-> ([GetStreamingImage] -> ShowS)
-> Show GetStreamingImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStreamingImage] -> ShowS
$cshowList :: [GetStreamingImage] -> ShowS
show :: GetStreamingImage -> String
$cshow :: GetStreamingImage -> String
showsPrec :: Int -> GetStreamingImage -> ShowS
$cshowsPrec :: Int -> GetStreamingImage -> ShowS
Prelude.Show, (forall x. GetStreamingImage -> Rep GetStreamingImage x)
-> (forall x. Rep GetStreamingImage x -> GetStreamingImage)
-> Generic GetStreamingImage
forall x. Rep GetStreamingImage x -> GetStreamingImage
forall x. GetStreamingImage -> Rep GetStreamingImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStreamingImage x -> GetStreamingImage
$cfrom :: forall x. GetStreamingImage -> Rep GetStreamingImage x
Prelude.Generic)

-- |
-- Create a value of 'GetStreamingImage' 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:
--
-- 'studioId', 'getStreamingImage_studioId' - The studio ID.
--
-- 'streamingImageId', 'getStreamingImage_streamingImageId' - The streaming image ID.
newGetStreamingImage ::
  -- | 'studioId'
  Prelude.Text ->
  -- | 'streamingImageId'
  Prelude.Text ->
  GetStreamingImage
newGetStreamingImage :: Text -> Text -> GetStreamingImage
newGetStreamingImage Text
pStudioId_ Text
pStreamingImageId_ =
  GetStreamingImage' :: Text -> Text -> GetStreamingImage
GetStreamingImage'
    { $sel:studioId:GetStreamingImage' :: Text
studioId = Text
pStudioId_,
      $sel:streamingImageId:GetStreamingImage' :: Text
streamingImageId = Text
pStreamingImageId_
    }

-- | The studio ID.
getStreamingImage_studioId :: Lens.Lens' GetStreamingImage Prelude.Text
getStreamingImage_studioId :: (Text -> f Text) -> GetStreamingImage -> f GetStreamingImage
getStreamingImage_studioId = (GetStreamingImage -> Text)
-> (GetStreamingImage -> Text -> GetStreamingImage)
-> Lens GetStreamingImage GetStreamingImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingImage' {Text
studioId :: Text
$sel:studioId:GetStreamingImage' :: GetStreamingImage -> Text
studioId} -> Text
studioId) (\s :: GetStreamingImage
s@GetStreamingImage' {} Text
a -> GetStreamingImage
s {$sel:studioId:GetStreamingImage' :: Text
studioId = Text
a} :: GetStreamingImage)

-- | The streaming image ID.
getStreamingImage_streamingImageId :: Lens.Lens' GetStreamingImage Prelude.Text
getStreamingImage_streamingImageId :: (Text -> f Text) -> GetStreamingImage -> f GetStreamingImage
getStreamingImage_streamingImageId = (GetStreamingImage -> Text)
-> (GetStreamingImage -> Text -> GetStreamingImage)
-> Lens GetStreamingImage GetStreamingImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingImage' {Text
streamingImageId :: Text
$sel:streamingImageId:GetStreamingImage' :: GetStreamingImage -> Text
streamingImageId} -> Text
streamingImageId) (\s :: GetStreamingImage
s@GetStreamingImage' {} Text
a -> GetStreamingImage
s {$sel:streamingImageId:GetStreamingImage' :: Text
streamingImageId = Text
a} :: GetStreamingImage)

instance Core.AWSRequest GetStreamingImage where
  type
    AWSResponse GetStreamingImage =
      GetStreamingImageResponse
  request :: GetStreamingImage -> Request GetStreamingImage
request = Service -> GetStreamingImage -> Request GetStreamingImage
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetStreamingImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetStreamingImage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetStreamingImage))
-> Logger
-> Service
-> Proxy GetStreamingImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetStreamingImage)))
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 StreamingImage -> Int -> GetStreamingImageResponse
GetStreamingImageResponse'
            (Maybe StreamingImage -> Int -> GetStreamingImageResponse)
-> Either String (Maybe StreamingImage)
-> Either String (Int -> GetStreamingImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StreamingImage)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"streamingImage")
            Either String (Int -> GetStreamingImageResponse)
-> Either String Int -> Either String GetStreamingImageResponse
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 GetStreamingImage

instance Prelude.NFData GetStreamingImage

instance Core.ToHeaders GetStreamingImage where
  toHeaders :: GetStreamingImage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetStreamingImage -> 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.ToPath GetStreamingImage where
  toPath :: GetStreamingImage -> ByteString
toPath GetStreamingImage' {Text
streamingImageId :: Text
studioId :: Text
$sel:streamingImageId:GetStreamingImage' :: GetStreamingImage -> Text
$sel:studioId:GetStreamingImage' :: GetStreamingImage -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-08-01/studios/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
studioId,
        ByteString
"/streaming-images/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
streamingImageId
      ]

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

-- | /See:/ 'newGetStreamingImageResponse' smart constructor.
data GetStreamingImageResponse = GetStreamingImageResponse'
  { -- | The streaming image.
    GetStreamingImageResponse -> Maybe StreamingImage
streamingImage :: Prelude.Maybe StreamingImage,
    -- | The response's http status code.
    GetStreamingImageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetStreamingImageResponse -> GetStreamingImageResponse -> Bool
(GetStreamingImageResponse -> GetStreamingImageResponse -> Bool)
-> (GetStreamingImageResponse -> GetStreamingImageResponse -> Bool)
-> Eq GetStreamingImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStreamingImageResponse -> GetStreamingImageResponse -> Bool
$c/= :: GetStreamingImageResponse -> GetStreamingImageResponse -> Bool
== :: GetStreamingImageResponse -> GetStreamingImageResponse -> Bool
$c== :: GetStreamingImageResponse -> GetStreamingImageResponse -> Bool
Prelude.Eq, ReadPrec [GetStreamingImageResponse]
ReadPrec GetStreamingImageResponse
Int -> ReadS GetStreamingImageResponse
ReadS [GetStreamingImageResponse]
(Int -> ReadS GetStreamingImageResponse)
-> ReadS [GetStreamingImageResponse]
-> ReadPrec GetStreamingImageResponse
-> ReadPrec [GetStreamingImageResponse]
-> Read GetStreamingImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStreamingImageResponse]
$creadListPrec :: ReadPrec [GetStreamingImageResponse]
readPrec :: ReadPrec GetStreamingImageResponse
$creadPrec :: ReadPrec GetStreamingImageResponse
readList :: ReadS [GetStreamingImageResponse]
$creadList :: ReadS [GetStreamingImageResponse]
readsPrec :: Int -> ReadS GetStreamingImageResponse
$creadsPrec :: Int -> ReadS GetStreamingImageResponse
Prelude.Read, Int -> GetStreamingImageResponse -> ShowS
[GetStreamingImageResponse] -> ShowS
GetStreamingImageResponse -> String
(Int -> GetStreamingImageResponse -> ShowS)
-> (GetStreamingImageResponse -> String)
-> ([GetStreamingImageResponse] -> ShowS)
-> Show GetStreamingImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStreamingImageResponse] -> ShowS
$cshowList :: [GetStreamingImageResponse] -> ShowS
show :: GetStreamingImageResponse -> String
$cshow :: GetStreamingImageResponse -> String
showsPrec :: Int -> GetStreamingImageResponse -> ShowS
$cshowsPrec :: Int -> GetStreamingImageResponse -> ShowS
Prelude.Show, (forall x.
 GetStreamingImageResponse -> Rep GetStreamingImageResponse x)
-> (forall x.
    Rep GetStreamingImageResponse x -> GetStreamingImageResponse)
-> Generic GetStreamingImageResponse
forall x.
Rep GetStreamingImageResponse x -> GetStreamingImageResponse
forall x.
GetStreamingImageResponse -> Rep GetStreamingImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetStreamingImageResponse x -> GetStreamingImageResponse
$cfrom :: forall x.
GetStreamingImageResponse -> Rep GetStreamingImageResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetStreamingImageResponse' 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:
--
-- 'streamingImage', 'getStreamingImageResponse_streamingImage' - The streaming image.
--
-- 'httpStatus', 'getStreamingImageResponse_httpStatus' - The response's http status code.
newGetStreamingImageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetStreamingImageResponse
newGetStreamingImageResponse :: Int -> GetStreamingImageResponse
newGetStreamingImageResponse Int
pHttpStatus_ =
  GetStreamingImageResponse' :: Maybe StreamingImage -> Int -> GetStreamingImageResponse
GetStreamingImageResponse'
    { $sel:streamingImage:GetStreamingImageResponse' :: Maybe StreamingImage
streamingImage =
        Maybe StreamingImage
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetStreamingImageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The streaming image.
getStreamingImageResponse_streamingImage :: Lens.Lens' GetStreamingImageResponse (Prelude.Maybe StreamingImage)
getStreamingImageResponse_streamingImage :: (Maybe StreamingImage -> f (Maybe StreamingImage))
-> GetStreamingImageResponse -> f GetStreamingImageResponse
getStreamingImageResponse_streamingImage = (GetStreamingImageResponse -> Maybe StreamingImage)
-> (GetStreamingImageResponse
    -> Maybe StreamingImage -> GetStreamingImageResponse)
-> Lens
     GetStreamingImageResponse
     GetStreamingImageResponse
     (Maybe StreamingImage)
     (Maybe StreamingImage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStreamingImageResponse' {Maybe StreamingImage
streamingImage :: Maybe StreamingImage
$sel:streamingImage:GetStreamingImageResponse' :: GetStreamingImageResponse -> Maybe StreamingImage
streamingImage} -> Maybe StreamingImage
streamingImage) (\s :: GetStreamingImageResponse
s@GetStreamingImageResponse' {} Maybe StreamingImage
a -> GetStreamingImageResponse
s {$sel:streamingImage:GetStreamingImageResponse' :: Maybe StreamingImage
streamingImage = Maybe StreamingImage
a} :: GetStreamingImageResponse)

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

instance Prelude.NFData GetStreamingImageResponse