{-# 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.RobOMaker.GetWorldTemplateBody
-- 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)
--
-- Gets the world template body.
module Amazonka.RobOMaker.GetWorldTemplateBody
  ( -- * Creating a Request
    GetWorldTemplateBody (..),
    newGetWorldTemplateBody,

    -- * Request Lenses
    getWorldTemplateBody_template,
    getWorldTemplateBody_generationJob,

    -- * Destructuring the Response
    GetWorldTemplateBodyResponse (..),
    newGetWorldTemplateBodyResponse,

    -- * Response Lenses
    getWorldTemplateBodyResponse_templateBody,
    getWorldTemplateBodyResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetWorldTemplateBody' smart constructor.
data GetWorldTemplateBody = GetWorldTemplateBody'
  { -- | The Amazon Resource Name (arn) of the world template.
    GetWorldTemplateBody -> Maybe Text
template :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (arn) of the world generator job.
    GetWorldTemplateBody -> Maybe Text
generationJob :: Prelude.Maybe Prelude.Text
  }
  deriving (GetWorldTemplateBody -> GetWorldTemplateBody -> Bool
(GetWorldTemplateBody -> GetWorldTemplateBody -> Bool)
-> (GetWorldTemplateBody -> GetWorldTemplateBody -> Bool)
-> Eq GetWorldTemplateBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetWorldTemplateBody -> GetWorldTemplateBody -> Bool
$c/= :: GetWorldTemplateBody -> GetWorldTemplateBody -> Bool
== :: GetWorldTemplateBody -> GetWorldTemplateBody -> Bool
$c== :: GetWorldTemplateBody -> GetWorldTemplateBody -> Bool
Prelude.Eq, ReadPrec [GetWorldTemplateBody]
ReadPrec GetWorldTemplateBody
Int -> ReadS GetWorldTemplateBody
ReadS [GetWorldTemplateBody]
(Int -> ReadS GetWorldTemplateBody)
-> ReadS [GetWorldTemplateBody]
-> ReadPrec GetWorldTemplateBody
-> ReadPrec [GetWorldTemplateBody]
-> Read GetWorldTemplateBody
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetWorldTemplateBody]
$creadListPrec :: ReadPrec [GetWorldTemplateBody]
readPrec :: ReadPrec GetWorldTemplateBody
$creadPrec :: ReadPrec GetWorldTemplateBody
readList :: ReadS [GetWorldTemplateBody]
$creadList :: ReadS [GetWorldTemplateBody]
readsPrec :: Int -> ReadS GetWorldTemplateBody
$creadsPrec :: Int -> ReadS GetWorldTemplateBody
Prelude.Read, Int -> GetWorldTemplateBody -> ShowS
[GetWorldTemplateBody] -> ShowS
GetWorldTemplateBody -> String
(Int -> GetWorldTemplateBody -> ShowS)
-> (GetWorldTemplateBody -> String)
-> ([GetWorldTemplateBody] -> ShowS)
-> Show GetWorldTemplateBody
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetWorldTemplateBody] -> ShowS
$cshowList :: [GetWorldTemplateBody] -> ShowS
show :: GetWorldTemplateBody -> String
$cshow :: GetWorldTemplateBody -> String
showsPrec :: Int -> GetWorldTemplateBody -> ShowS
$cshowsPrec :: Int -> GetWorldTemplateBody -> ShowS
Prelude.Show, (forall x. GetWorldTemplateBody -> Rep GetWorldTemplateBody x)
-> (forall x. Rep GetWorldTemplateBody x -> GetWorldTemplateBody)
-> Generic GetWorldTemplateBody
forall x. Rep GetWorldTemplateBody x -> GetWorldTemplateBody
forall x. GetWorldTemplateBody -> Rep GetWorldTemplateBody x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetWorldTemplateBody x -> GetWorldTemplateBody
$cfrom :: forall x. GetWorldTemplateBody -> Rep GetWorldTemplateBody x
Prelude.Generic)

-- |
-- Create a value of 'GetWorldTemplateBody' 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:
--
-- 'template', 'getWorldTemplateBody_template' - The Amazon Resource Name (arn) of the world template.
--
-- 'generationJob', 'getWorldTemplateBody_generationJob' - The Amazon Resource Name (arn) of the world generator job.
newGetWorldTemplateBody ::
  GetWorldTemplateBody
newGetWorldTemplateBody :: GetWorldTemplateBody
newGetWorldTemplateBody =
  GetWorldTemplateBody' :: Maybe Text -> Maybe Text -> GetWorldTemplateBody
GetWorldTemplateBody'
    { $sel:template:GetWorldTemplateBody' :: Maybe Text
template = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:generationJob:GetWorldTemplateBody' :: Maybe Text
generationJob = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (arn) of the world template.
getWorldTemplateBody_template :: Lens.Lens' GetWorldTemplateBody (Prelude.Maybe Prelude.Text)
getWorldTemplateBody_template :: (Maybe Text -> f (Maybe Text))
-> GetWorldTemplateBody -> f GetWorldTemplateBody
getWorldTemplateBody_template = (GetWorldTemplateBody -> Maybe Text)
-> (GetWorldTemplateBody -> Maybe Text -> GetWorldTemplateBody)
-> Lens
     GetWorldTemplateBody GetWorldTemplateBody (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorldTemplateBody' {Maybe Text
template :: Maybe Text
$sel:template:GetWorldTemplateBody' :: GetWorldTemplateBody -> Maybe Text
template} -> Maybe Text
template) (\s :: GetWorldTemplateBody
s@GetWorldTemplateBody' {} Maybe Text
a -> GetWorldTemplateBody
s {$sel:template:GetWorldTemplateBody' :: Maybe Text
template = Maybe Text
a} :: GetWorldTemplateBody)

-- | The Amazon Resource Name (arn) of the world generator job.
getWorldTemplateBody_generationJob :: Lens.Lens' GetWorldTemplateBody (Prelude.Maybe Prelude.Text)
getWorldTemplateBody_generationJob :: (Maybe Text -> f (Maybe Text))
-> GetWorldTemplateBody -> f GetWorldTemplateBody
getWorldTemplateBody_generationJob = (GetWorldTemplateBody -> Maybe Text)
-> (GetWorldTemplateBody -> Maybe Text -> GetWorldTemplateBody)
-> Lens
     GetWorldTemplateBody GetWorldTemplateBody (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorldTemplateBody' {Maybe Text
generationJob :: Maybe Text
$sel:generationJob:GetWorldTemplateBody' :: GetWorldTemplateBody -> Maybe Text
generationJob} -> Maybe Text
generationJob) (\s :: GetWorldTemplateBody
s@GetWorldTemplateBody' {} Maybe Text
a -> GetWorldTemplateBody
s {$sel:generationJob:GetWorldTemplateBody' :: Maybe Text
generationJob = Maybe Text
a} :: GetWorldTemplateBody)

instance Core.AWSRequest GetWorldTemplateBody where
  type
    AWSResponse GetWorldTemplateBody =
      GetWorldTemplateBodyResponse
  request :: GetWorldTemplateBody -> Request GetWorldTemplateBody
request = Service -> GetWorldTemplateBody -> Request GetWorldTemplateBody
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetWorldTemplateBody
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetWorldTemplateBody)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetWorldTemplateBody))
-> Logger
-> Service
-> Proxy GetWorldTemplateBody
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetWorldTemplateBody)))
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 Text -> Int -> GetWorldTemplateBodyResponse
GetWorldTemplateBodyResponse'
            (Maybe Text -> Int -> GetWorldTemplateBodyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetWorldTemplateBodyResponse)
forall (f :: * -> *) a b. Functor 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
"templateBody")
            Either String (Int -> GetWorldTemplateBodyResponse)
-> Either String Int -> Either String GetWorldTemplateBodyResponse
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 GetWorldTemplateBody

instance Prelude.NFData GetWorldTemplateBody

instance Core.ToHeaders GetWorldTemplateBody where
  toHeaders :: GetWorldTemplateBody -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetWorldTemplateBody -> 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 GetWorldTemplateBody where
  toJSON :: GetWorldTemplateBody -> Value
toJSON GetWorldTemplateBody' {Maybe Text
generationJob :: Maybe Text
template :: Maybe Text
$sel:generationJob:GetWorldTemplateBody' :: GetWorldTemplateBody -> Maybe Text
$sel:template:GetWorldTemplateBody' :: GetWorldTemplateBody -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"template" 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
template,
            (Text
"generationJob" 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
generationJob
          ]
      )

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

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

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

-- |
-- Create a value of 'GetWorldTemplateBodyResponse' 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:
--
-- 'templateBody', 'getWorldTemplateBodyResponse_templateBody' - The world template body.
--
-- 'httpStatus', 'getWorldTemplateBodyResponse_httpStatus' - The response's http status code.
newGetWorldTemplateBodyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetWorldTemplateBodyResponse
newGetWorldTemplateBodyResponse :: Int -> GetWorldTemplateBodyResponse
newGetWorldTemplateBodyResponse Int
pHttpStatus_ =
  GetWorldTemplateBodyResponse' :: Maybe Text -> Int -> GetWorldTemplateBodyResponse
GetWorldTemplateBodyResponse'
    { $sel:templateBody:GetWorldTemplateBodyResponse' :: Maybe Text
templateBody =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetWorldTemplateBodyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The world template body.
getWorldTemplateBodyResponse_templateBody :: Lens.Lens' GetWorldTemplateBodyResponse (Prelude.Maybe Prelude.Text)
getWorldTemplateBodyResponse_templateBody :: (Maybe Text -> f (Maybe Text))
-> GetWorldTemplateBodyResponse -> f GetWorldTemplateBodyResponse
getWorldTemplateBodyResponse_templateBody = (GetWorldTemplateBodyResponse -> Maybe Text)
-> (GetWorldTemplateBodyResponse
    -> Maybe Text -> GetWorldTemplateBodyResponse)
-> Lens
     GetWorldTemplateBodyResponse
     GetWorldTemplateBodyResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetWorldTemplateBodyResponse' {Maybe Text
templateBody :: Maybe Text
$sel:templateBody:GetWorldTemplateBodyResponse' :: GetWorldTemplateBodyResponse -> Maybe Text
templateBody} -> Maybe Text
templateBody) (\s :: GetWorldTemplateBodyResponse
s@GetWorldTemplateBodyResponse' {} Maybe Text
a -> GetWorldTemplateBodyResponse
s {$sel:templateBody:GetWorldTemplateBodyResponse' :: Maybe Text
templateBody = Maybe Text
a} :: GetWorldTemplateBodyResponse)

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

instance Prelude.NFData GetWorldTemplateBodyResponse