{-# 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.DescribeProject
-- 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 project.
--
-- This operation requires permissions to perform the
-- @lookoutvision:DescribeProject@ operation.
module Amazonka.LookoutVision.DescribeProject
  ( -- * Creating a Request
    DescribeProject (..),
    newDescribeProject,

    -- * Request Lenses
    describeProject_projectName,

    -- * Destructuring the Response
    DescribeProjectResponse (..),
    newDescribeProjectResponse,

    -- * Response Lenses
    describeProjectResponse_projectDescription,
    describeProjectResponse_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:/ 'newDescribeProject' smart constructor.
data DescribeProject = DescribeProject'
  { -- | The name of the project that you want to describe.
    DescribeProject -> Text
projectName :: Prelude.Text
  }
  deriving (DescribeProject -> DescribeProject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProject -> DescribeProject -> Bool
$c/= :: DescribeProject -> DescribeProject -> Bool
== :: DescribeProject -> DescribeProject -> Bool
$c== :: DescribeProject -> DescribeProject -> Bool
Prelude.Eq, ReadPrec [DescribeProject]
ReadPrec DescribeProject
Int -> ReadS DescribeProject
ReadS [DescribeProject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProject]
$creadListPrec :: ReadPrec [DescribeProject]
readPrec :: ReadPrec DescribeProject
$creadPrec :: ReadPrec DescribeProject
readList :: ReadS [DescribeProject]
$creadList :: ReadS [DescribeProject]
readsPrec :: Int -> ReadS DescribeProject
$creadsPrec :: Int -> ReadS DescribeProject
Prelude.Read, Int -> DescribeProject -> ShowS
[DescribeProject] -> ShowS
DescribeProject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProject] -> ShowS
$cshowList :: [DescribeProject] -> ShowS
show :: DescribeProject -> String
$cshow :: DescribeProject -> String
showsPrec :: Int -> DescribeProject -> ShowS
$cshowsPrec :: Int -> DescribeProject -> ShowS
Prelude.Show, forall x. Rep DescribeProject x -> DescribeProject
forall x. DescribeProject -> Rep DescribeProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeProject x -> DescribeProject
$cfrom :: forall x. DescribeProject -> Rep DescribeProject x
Prelude.Generic)

-- |
-- Create a value of 'DescribeProject' 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', 'describeProject_projectName' - The name of the project that you want to describe.
newDescribeProject ::
  -- | 'projectName'
  Prelude.Text ->
  DescribeProject
newDescribeProject :: Text -> DescribeProject
newDescribeProject Text
pProjectName_ =
  DescribeProject' {$sel:projectName:DescribeProject' :: Text
projectName = Text
pProjectName_}

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

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

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

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

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

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

-- |
-- Create a value of 'DescribeProjectResponse' 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:
--
-- 'projectDescription', 'describeProjectResponse_projectDescription' - The description of the project.
--
-- 'httpStatus', 'describeProjectResponse_httpStatus' - The response's http status code.
newDescribeProjectResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeProjectResponse
newDescribeProjectResponse :: Int -> DescribeProjectResponse
newDescribeProjectResponse Int
pHttpStatus_ =
  DescribeProjectResponse'
    { $sel:projectDescription:DescribeProjectResponse' :: Maybe ProjectDescription
projectDescription =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeProjectResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The description of the project.
describeProjectResponse_projectDescription :: Lens.Lens' DescribeProjectResponse (Prelude.Maybe ProjectDescription)
describeProjectResponse_projectDescription :: Lens' DescribeProjectResponse (Maybe ProjectDescription)
describeProjectResponse_projectDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectResponse' {Maybe ProjectDescription
projectDescription :: Maybe ProjectDescription
$sel:projectDescription:DescribeProjectResponse' :: DescribeProjectResponse -> Maybe ProjectDescription
projectDescription} -> Maybe ProjectDescription
projectDescription) (\s :: DescribeProjectResponse
s@DescribeProjectResponse' {} Maybe ProjectDescription
a -> DescribeProjectResponse
s {$sel:projectDescription:DescribeProjectResponse' :: Maybe ProjectDescription
projectDescription = Maybe ProjectDescription
a} :: DescribeProjectResponse)

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

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