{-# 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.LookoutVision.DescribeModelPackagingJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes an Amazon Lookout for Vision model packaging job.
--
-- This operation requires permissions to perform the
-- @lookoutvision:DescribeModelPackagingJob@ operation.
--
-- For more information, see /Using your Amazon Lookout for Vision model on
-- an edge device/ in the Amazon Lookout for Vision Developer Guide.
module Amazonka.LookoutVision.DescribeModelPackagingJob
  ( -- * Creating a Request
    DescribeModelPackagingJob (..),
    newDescribeModelPackagingJob,

    -- * Request Lenses
    describeModelPackagingJob_projectName,
    describeModelPackagingJob_jobName,

    -- * Destructuring the Response
    DescribeModelPackagingJobResponse (..),
    newDescribeModelPackagingJobResponse,

    -- * Response Lenses
    describeModelPackagingJobResponse_modelPackagingDescription,
    describeModelPackagingJobResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeModelPackagingJob' smart constructor.
data DescribeModelPackagingJob = DescribeModelPackagingJob'
  { -- | The name of the project that contains the model packaging job that you
    -- want to describe.
    DescribeModelPackagingJob -> Text
projectName :: Prelude.Text,
    -- | The job name for the model packaging job.
    DescribeModelPackagingJob -> Text
jobName :: Prelude.Text
  }
  deriving (DescribeModelPackagingJob -> DescribeModelPackagingJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeModelPackagingJob -> DescribeModelPackagingJob -> Bool
$c/= :: DescribeModelPackagingJob -> DescribeModelPackagingJob -> Bool
== :: DescribeModelPackagingJob -> DescribeModelPackagingJob -> Bool
$c== :: DescribeModelPackagingJob -> DescribeModelPackagingJob -> Bool
Prelude.Eq, ReadPrec [DescribeModelPackagingJob]
ReadPrec DescribeModelPackagingJob
Int -> ReadS DescribeModelPackagingJob
ReadS [DescribeModelPackagingJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeModelPackagingJob]
$creadListPrec :: ReadPrec [DescribeModelPackagingJob]
readPrec :: ReadPrec DescribeModelPackagingJob
$creadPrec :: ReadPrec DescribeModelPackagingJob
readList :: ReadS [DescribeModelPackagingJob]
$creadList :: ReadS [DescribeModelPackagingJob]
readsPrec :: Int -> ReadS DescribeModelPackagingJob
$creadsPrec :: Int -> ReadS DescribeModelPackagingJob
Prelude.Read, Int -> DescribeModelPackagingJob -> ShowS
[DescribeModelPackagingJob] -> ShowS
DescribeModelPackagingJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeModelPackagingJob] -> ShowS
$cshowList :: [DescribeModelPackagingJob] -> ShowS
show :: DescribeModelPackagingJob -> String
$cshow :: DescribeModelPackagingJob -> String
showsPrec :: Int -> DescribeModelPackagingJob -> ShowS
$cshowsPrec :: Int -> DescribeModelPackagingJob -> ShowS
Prelude.Show, forall x.
Rep DescribeModelPackagingJob x -> DescribeModelPackagingJob
forall x.
DescribeModelPackagingJob -> Rep DescribeModelPackagingJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeModelPackagingJob x -> DescribeModelPackagingJob
$cfrom :: forall x.
DescribeModelPackagingJob -> Rep DescribeModelPackagingJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeModelPackagingJob' 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:
--
-- 'projectName', 'describeModelPackagingJob_projectName' - The name of the project that contains the model packaging job that you
-- want to describe.
--
-- 'jobName', 'describeModelPackagingJob_jobName' - The job name for the model packaging job.
newDescribeModelPackagingJob ::
  -- | 'projectName'
  Prelude.Text ->
  -- | 'jobName'
  Prelude.Text ->
  DescribeModelPackagingJob
newDescribeModelPackagingJob :: Text -> Text -> DescribeModelPackagingJob
newDescribeModelPackagingJob Text
pProjectName_ Text
pJobName_ =
  DescribeModelPackagingJob'
    { $sel:projectName:DescribeModelPackagingJob' :: Text
projectName =
        Text
pProjectName_,
      $sel:jobName:DescribeModelPackagingJob' :: Text
jobName = Text
pJobName_
    }

-- | The name of the project that contains the model packaging job that you
-- want to describe.
describeModelPackagingJob_projectName :: Lens.Lens' DescribeModelPackagingJob Prelude.Text
describeModelPackagingJob_projectName :: Lens' DescribeModelPackagingJob Text
describeModelPackagingJob_projectName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeModelPackagingJob' {Text
projectName :: Text
$sel:projectName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
projectName} -> Text
projectName) (\s :: DescribeModelPackagingJob
s@DescribeModelPackagingJob' {} Text
a -> DescribeModelPackagingJob
s {$sel:projectName:DescribeModelPackagingJob' :: Text
projectName = Text
a} :: DescribeModelPackagingJob)

-- | The job name for the model packaging job.
describeModelPackagingJob_jobName :: Lens.Lens' DescribeModelPackagingJob Prelude.Text
describeModelPackagingJob_jobName :: Lens' DescribeModelPackagingJob Text
describeModelPackagingJob_jobName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeModelPackagingJob' {Text
jobName :: Text
$sel:jobName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
jobName} -> Text
jobName) (\s :: DescribeModelPackagingJob
s@DescribeModelPackagingJob' {} Text
a -> DescribeModelPackagingJob
s {$sel:jobName:DescribeModelPackagingJob' :: Text
jobName = Text
a} :: DescribeModelPackagingJob)

instance Core.AWSRequest DescribeModelPackagingJob where
  type
    AWSResponse DescribeModelPackagingJob =
      DescribeModelPackagingJobResponse
  request :: (Service -> Service)
-> DescribeModelPackagingJob -> Request DescribeModelPackagingJob
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 DescribeModelPackagingJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeModelPackagingJob)))
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 ModelPackagingDescription
-> Int -> DescribeModelPackagingJobResponse
DescribeModelPackagingJobResponse'
            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
"ModelPackagingDescription")
            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 DescribeModelPackagingJob where
  hashWithSalt :: Int -> DescribeModelPackagingJob -> Int
hashWithSalt Int
_salt DescribeModelPackagingJob' {Text
jobName :: Text
projectName :: Text
$sel:jobName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
$sel:projectName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
projectName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobName

instance Prelude.NFData DescribeModelPackagingJob where
  rnf :: DescribeModelPackagingJob -> ()
rnf DescribeModelPackagingJob' {Text
jobName :: Text
projectName :: Text
$sel:jobName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
$sel:projectName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
projectName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
jobName

instance Data.ToHeaders DescribeModelPackagingJob where
  toHeaders :: DescribeModelPackagingJob -> 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 DescribeModelPackagingJob where
  toPath :: DescribeModelPackagingJob -> ByteString
toPath DescribeModelPackagingJob' {Text
jobName :: Text
projectName :: Text
$sel:jobName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
$sel:projectName:DescribeModelPackagingJob' :: DescribeModelPackagingJob -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-11-20/projects/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
projectName,
        ByteString
"/modelpackagingjobs/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
jobName
      ]

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

-- | /See:/ 'newDescribeModelPackagingJobResponse' smart constructor.
data DescribeModelPackagingJobResponse = DescribeModelPackagingJobResponse'
  { -- | The description of the model packaging job.
    DescribeModelPackagingJobResponse
-> Maybe ModelPackagingDescription
modelPackagingDescription :: Prelude.Maybe ModelPackagingDescription,
    -- | The response's http status code.
    DescribeModelPackagingJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeModelPackagingJobResponse
-> DescribeModelPackagingJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeModelPackagingJobResponse
-> DescribeModelPackagingJobResponse -> Bool
$c/= :: DescribeModelPackagingJobResponse
-> DescribeModelPackagingJobResponse -> Bool
== :: DescribeModelPackagingJobResponse
-> DescribeModelPackagingJobResponse -> Bool
$c== :: DescribeModelPackagingJobResponse
-> DescribeModelPackagingJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeModelPackagingJobResponse]
ReadPrec DescribeModelPackagingJobResponse
Int -> ReadS DescribeModelPackagingJobResponse
ReadS [DescribeModelPackagingJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeModelPackagingJobResponse]
$creadListPrec :: ReadPrec [DescribeModelPackagingJobResponse]
readPrec :: ReadPrec DescribeModelPackagingJobResponse
$creadPrec :: ReadPrec DescribeModelPackagingJobResponse
readList :: ReadS [DescribeModelPackagingJobResponse]
$creadList :: ReadS [DescribeModelPackagingJobResponse]
readsPrec :: Int -> ReadS DescribeModelPackagingJobResponse
$creadsPrec :: Int -> ReadS DescribeModelPackagingJobResponse
Prelude.Read, Int -> DescribeModelPackagingJobResponse -> ShowS
[DescribeModelPackagingJobResponse] -> ShowS
DescribeModelPackagingJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeModelPackagingJobResponse] -> ShowS
$cshowList :: [DescribeModelPackagingJobResponse] -> ShowS
show :: DescribeModelPackagingJobResponse -> String
$cshow :: DescribeModelPackagingJobResponse -> String
showsPrec :: Int -> DescribeModelPackagingJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeModelPackagingJobResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeModelPackagingJobResponse x
-> DescribeModelPackagingJobResponse
forall x.
DescribeModelPackagingJobResponse
-> Rep DescribeModelPackagingJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeModelPackagingJobResponse x
-> DescribeModelPackagingJobResponse
$cfrom :: forall x.
DescribeModelPackagingJobResponse
-> Rep DescribeModelPackagingJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeModelPackagingJobResponse' 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:
--
-- 'modelPackagingDescription', 'describeModelPackagingJobResponse_modelPackagingDescription' - The description of the model packaging job.
--
-- 'httpStatus', 'describeModelPackagingJobResponse_httpStatus' - The response's http status code.
newDescribeModelPackagingJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeModelPackagingJobResponse
newDescribeModelPackagingJobResponse :: Int -> DescribeModelPackagingJobResponse
newDescribeModelPackagingJobResponse Int
pHttpStatus_ =
  DescribeModelPackagingJobResponse'
    { $sel:modelPackagingDescription:DescribeModelPackagingJobResponse' :: Maybe ModelPackagingDescription
modelPackagingDescription =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeModelPackagingJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The description of the model packaging job.
describeModelPackagingJobResponse_modelPackagingDescription :: Lens.Lens' DescribeModelPackagingJobResponse (Prelude.Maybe ModelPackagingDescription)
describeModelPackagingJobResponse_modelPackagingDescription :: Lens'
  DescribeModelPackagingJobResponse (Maybe ModelPackagingDescription)
describeModelPackagingJobResponse_modelPackagingDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeModelPackagingJobResponse' {Maybe ModelPackagingDescription
modelPackagingDescription :: Maybe ModelPackagingDescription
$sel:modelPackagingDescription:DescribeModelPackagingJobResponse' :: DescribeModelPackagingJobResponse
-> Maybe ModelPackagingDescription
modelPackagingDescription} -> Maybe ModelPackagingDescription
modelPackagingDescription) (\s :: DescribeModelPackagingJobResponse
s@DescribeModelPackagingJobResponse' {} Maybe ModelPackagingDescription
a -> DescribeModelPackagingJobResponse
s {$sel:modelPackagingDescription:DescribeModelPackagingJobResponse' :: Maybe ModelPackagingDescription
modelPackagingDescription = Maybe ModelPackagingDescription
a} :: DescribeModelPackagingJobResponse)

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

instance
  Prelude.NFData
    DescribeModelPackagingJobResponse
  where
  rnf :: DescribeModelPackagingJobResponse -> ()
rnf DescribeModelPackagingJobResponse' {Int
Maybe ModelPackagingDescription
httpStatus :: Int
modelPackagingDescription :: Maybe ModelPackagingDescription
$sel:httpStatus:DescribeModelPackagingJobResponse' :: DescribeModelPackagingJobResponse -> Int
$sel:modelPackagingDescription:DescribeModelPackagingJobResponse' :: DescribeModelPackagingJobResponse
-> Maybe ModelPackagingDescription
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ModelPackagingDescription
modelPackagingDescription
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus