{-# 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.Rekognition.DescribeProjectVersions
-- 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)
--
-- Lists and describes the models in an Amazon Rekognition Custom Labels
-- project. You can specify up to 10 model versions in
-- @ProjectVersionArns@. If you don\'t specify a value, descriptions for
-- all models are returned.
--
-- This operation requires permissions to perform the
-- @rekognition:DescribeProjectVersions@ action.
--
-- This operation returns paginated results.
module Amazonka.Rekognition.DescribeProjectVersions
  ( -- * Creating a Request
    DescribeProjectVersions (..),
    newDescribeProjectVersions,

    -- * Request Lenses
    describeProjectVersions_nextToken,
    describeProjectVersions_versionNames,
    describeProjectVersions_maxResults,
    describeProjectVersions_projectArn,

    -- * Destructuring the Response
    DescribeProjectVersionsResponse (..),
    newDescribeProjectVersionsResponse,

    -- * Response Lenses
    describeProjectVersionsResponse_nextToken,
    describeProjectVersionsResponse_projectVersionDescriptions,
    describeProjectVersionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeProjectVersions' smart constructor.
data DescribeProjectVersions = DescribeProjectVersions'
  { -- | If the previous response was incomplete (because there is more results
    -- to retrieve), Amazon Rekognition Custom Labels returns a pagination
    -- token in the response. You can use this pagination token to retrieve the
    -- next set of results.
    DescribeProjectVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of model version names that you want to describe. You can add up
    -- to 10 model version names to the list. If you don\'t specify a value,
    -- all model descriptions are returned. A version name is part of a model
    -- (ProjectVersion) ARN. For example, @my-model.2020-01-21T09.10.15@ is the
    -- version name in the following ARN.
    -- @arn:aws:rekognition:us-east-1:123456789012:project\/getting-started\/version\/my-model.2020-01-21T09.10.15\/1234567890123@.
    DescribeProjectVersions -> Maybe (NonEmpty Text)
versionNames :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The maximum number of results to return per paginated call. The largest
    -- value you can specify is 100. If you specify a value greater than 100, a
    -- ValidationException error occurs. The default value is 100.
    DescribeProjectVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) of the project that contains the models
    -- you want to describe.
    DescribeProjectVersions -> Text
projectArn :: Prelude.Text
  }
  deriving (DescribeProjectVersions -> DescribeProjectVersions -> Bool
(DescribeProjectVersions -> DescribeProjectVersions -> Bool)
-> (DescribeProjectVersions -> DescribeProjectVersions -> Bool)
-> Eq DescribeProjectVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProjectVersions -> DescribeProjectVersions -> Bool
$c/= :: DescribeProjectVersions -> DescribeProjectVersions -> Bool
== :: DescribeProjectVersions -> DescribeProjectVersions -> Bool
$c== :: DescribeProjectVersions -> DescribeProjectVersions -> Bool
Prelude.Eq, ReadPrec [DescribeProjectVersions]
ReadPrec DescribeProjectVersions
Int -> ReadS DescribeProjectVersions
ReadS [DescribeProjectVersions]
(Int -> ReadS DescribeProjectVersions)
-> ReadS [DescribeProjectVersions]
-> ReadPrec DescribeProjectVersions
-> ReadPrec [DescribeProjectVersions]
-> Read DescribeProjectVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProjectVersions]
$creadListPrec :: ReadPrec [DescribeProjectVersions]
readPrec :: ReadPrec DescribeProjectVersions
$creadPrec :: ReadPrec DescribeProjectVersions
readList :: ReadS [DescribeProjectVersions]
$creadList :: ReadS [DescribeProjectVersions]
readsPrec :: Int -> ReadS DescribeProjectVersions
$creadsPrec :: Int -> ReadS DescribeProjectVersions
Prelude.Read, Int -> DescribeProjectVersions -> ShowS
[DescribeProjectVersions] -> ShowS
DescribeProjectVersions -> String
(Int -> DescribeProjectVersions -> ShowS)
-> (DescribeProjectVersions -> String)
-> ([DescribeProjectVersions] -> ShowS)
-> Show DescribeProjectVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProjectVersions] -> ShowS
$cshowList :: [DescribeProjectVersions] -> ShowS
show :: DescribeProjectVersions -> String
$cshow :: DescribeProjectVersions -> String
showsPrec :: Int -> DescribeProjectVersions -> ShowS
$cshowsPrec :: Int -> DescribeProjectVersions -> ShowS
Prelude.Show, (forall x.
 DescribeProjectVersions -> Rep DescribeProjectVersions x)
-> (forall x.
    Rep DescribeProjectVersions x -> DescribeProjectVersions)
-> Generic DescribeProjectVersions
forall x. Rep DescribeProjectVersions x -> DescribeProjectVersions
forall x. DescribeProjectVersions -> Rep DescribeProjectVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeProjectVersions x -> DescribeProjectVersions
$cfrom :: forall x. DescribeProjectVersions -> Rep DescribeProjectVersions x
Prelude.Generic)

-- |
-- Create a value of 'DescribeProjectVersions' 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:
--
-- 'nextToken', 'describeProjectVersions_nextToken' - If the previous response was incomplete (because there is more results
-- to retrieve), Amazon Rekognition Custom Labels returns a pagination
-- token in the response. You can use this pagination token to retrieve the
-- next set of results.
--
-- 'versionNames', 'describeProjectVersions_versionNames' - A list of model version names that you want to describe. You can add up
-- to 10 model version names to the list. If you don\'t specify a value,
-- all model descriptions are returned. A version name is part of a model
-- (ProjectVersion) ARN. For example, @my-model.2020-01-21T09.10.15@ is the
-- version name in the following ARN.
-- @arn:aws:rekognition:us-east-1:123456789012:project\/getting-started\/version\/my-model.2020-01-21T09.10.15\/1234567890123@.
--
-- 'maxResults', 'describeProjectVersions_maxResults' - The maximum number of results to return per paginated call. The largest
-- value you can specify is 100. If you specify a value greater than 100, a
-- ValidationException error occurs. The default value is 100.
--
-- 'projectArn', 'describeProjectVersions_projectArn' - The Amazon Resource Name (ARN) of the project that contains the models
-- you want to describe.
newDescribeProjectVersions ::
  -- | 'projectArn'
  Prelude.Text ->
  DescribeProjectVersions
newDescribeProjectVersions :: Text -> DescribeProjectVersions
newDescribeProjectVersions Text
pProjectArn_ =
  DescribeProjectVersions' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe Natural
-> Text
-> DescribeProjectVersions
DescribeProjectVersions'
    { $sel:nextToken:DescribeProjectVersions' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:versionNames:DescribeProjectVersions' :: Maybe (NonEmpty Text)
versionNames = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeProjectVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:projectArn:DescribeProjectVersions' :: Text
projectArn = Text
pProjectArn_
    }

-- | If the previous response was incomplete (because there is more results
-- to retrieve), Amazon Rekognition Custom Labels returns a pagination
-- token in the response. You can use this pagination token to retrieve the
-- next set of results.
describeProjectVersions_nextToken :: Lens.Lens' DescribeProjectVersions (Prelude.Maybe Prelude.Text)
describeProjectVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeProjectVersions -> f DescribeProjectVersions
describeProjectVersions_nextToken = (DescribeProjectVersions -> Maybe Text)
-> (DescribeProjectVersions
    -> Maybe Text -> DescribeProjectVersions)
-> Lens
     DescribeProjectVersions
     DescribeProjectVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeProjectVersions' :: DescribeProjectVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeProjectVersions
s@DescribeProjectVersions' {} Maybe Text
a -> DescribeProjectVersions
s {$sel:nextToken:DescribeProjectVersions' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeProjectVersions)

-- | A list of model version names that you want to describe. You can add up
-- to 10 model version names to the list. If you don\'t specify a value,
-- all model descriptions are returned. A version name is part of a model
-- (ProjectVersion) ARN. For example, @my-model.2020-01-21T09.10.15@ is the
-- version name in the following ARN.
-- @arn:aws:rekognition:us-east-1:123456789012:project\/getting-started\/version\/my-model.2020-01-21T09.10.15\/1234567890123@.
describeProjectVersions_versionNames :: Lens.Lens' DescribeProjectVersions (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeProjectVersions_versionNames :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeProjectVersions -> f DescribeProjectVersions
describeProjectVersions_versionNames = (DescribeProjectVersions -> Maybe (NonEmpty Text))
-> (DescribeProjectVersions
    -> Maybe (NonEmpty Text) -> DescribeProjectVersions)
-> Lens
     DescribeProjectVersions
     DescribeProjectVersions
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectVersions' {Maybe (NonEmpty Text)
versionNames :: Maybe (NonEmpty Text)
$sel:versionNames:DescribeProjectVersions' :: DescribeProjectVersions -> Maybe (NonEmpty Text)
versionNames} -> Maybe (NonEmpty Text)
versionNames) (\s :: DescribeProjectVersions
s@DescribeProjectVersions' {} Maybe (NonEmpty Text)
a -> DescribeProjectVersions
s {$sel:versionNames:DescribeProjectVersions' :: Maybe (NonEmpty Text)
versionNames = Maybe (NonEmpty Text)
a} :: DescribeProjectVersions) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeProjectVersions -> f DescribeProjectVersions)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeProjectVersions
-> f DescribeProjectVersions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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 AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of results to return per paginated call. The largest
-- value you can specify is 100. If you specify a value greater than 100, a
-- ValidationException error occurs. The default value is 100.
describeProjectVersions_maxResults :: Lens.Lens' DescribeProjectVersions (Prelude.Maybe Prelude.Natural)
describeProjectVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeProjectVersions -> f DescribeProjectVersions
describeProjectVersions_maxResults = (DescribeProjectVersions -> Maybe Natural)
-> (DescribeProjectVersions
    -> Maybe Natural -> DescribeProjectVersions)
-> Lens
     DescribeProjectVersions
     DescribeProjectVersions
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeProjectVersions' :: DescribeProjectVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeProjectVersions
s@DescribeProjectVersions' {} Maybe Natural
a -> DescribeProjectVersions
s {$sel:maxResults:DescribeProjectVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeProjectVersions)

-- | The Amazon Resource Name (ARN) of the project that contains the models
-- you want to describe.
describeProjectVersions_projectArn :: Lens.Lens' DescribeProjectVersions Prelude.Text
describeProjectVersions_projectArn :: (Text -> f Text)
-> DescribeProjectVersions -> f DescribeProjectVersions
describeProjectVersions_projectArn = (DescribeProjectVersions -> Text)
-> (DescribeProjectVersions -> Text -> DescribeProjectVersions)
-> Lens DescribeProjectVersions DescribeProjectVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectVersions' {Text
projectArn :: Text
$sel:projectArn:DescribeProjectVersions' :: DescribeProjectVersions -> Text
projectArn} -> Text
projectArn) (\s :: DescribeProjectVersions
s@DescribeProjectVersions' {} Text
a -> DescribeProjectVersions
s {$sel:projectArn:DescribeProjectVersions' :: Text
projectArn = Text
a} :: DescribeProjectVersions)

instance Core.AWSPager DescribeProjectVersions where
  page :: DescribeProjectVersions
-> AWSResponse DescribeProjectVersions
-> Maybe DescribeProjectVersions
page DescribeProjectVersions
rq AWSResponse DescribeProjectVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeProjectVersions
DescribeProjectVersionsResponse
rs
            DescribeProjectVersionsResponse
-> Getting (First Text) DescribeProjectVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeProjectVersionsResponse
-> Const (First Text) DescribeProjectVersionsResponse
Lens' DescribeProjectVersionsResponse (Maybe Text)
describeProjectVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeProjectVersionsResponse
 -> Const (First Text) DescribeProjectVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeProjectVersionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeProjectVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [ProjectVersionDescription] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeProjectVersions
DescribeProjectVersionsResponse
rs
            DescribeProjectVersionsResponse
-> Getting
     (First [ProjectVersionDescription])
     DescribeProjectVersionsResponse
     [ProjectVersionDescription]
-> Maybe [ProjectVersionDescription]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ProjectVersionDescription]
 -> Const
      (First [ProjectVersionDescription])
      (Maybe [ProjectVersionDescription]))
-> DescribeProjectVersionsResponse
-> Const
     (First [ProjectVersionDescription]) DescribeProjectVersionsResponse
Lens'
  DescribeProjectVersionsResponse (Maybe [ProjectVersionDescription])
describeProjectVersionsResponse_projectVersionDescriptions
              ((Maybe [ProjectVersionDescription]
  -> Const
       (First [ProjectVersionDescription])
       (Maybe [ProjectVersionDescription]))
 -> DescribeProjectVersionsResponse
 -> Const
      (First [ProjectVersionDescription])
      DescribeProjectVersionsResponse)
-> (([ProjectVersionDescription]
     -> Const
          (First [ProjectVersionDescription]) [ProjectVersionDescription])
    -> Maybe [ProjectVersionDescription]
    -> Const
         (First [ProjectVersionDescription])
         (Maybe [ProjectVersionDescription]))
-> Getting
     (First [ProjectVersionDescription])
     DescribeProjectVersionsResponse
     [ProjectVersionDescription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ProjectVersionDescription]
 -> Const
      (First [ProjectVersionDescription]) [ProjectVersionDescription])
-> Maybe [ProjectVersionDescription]
-> Const
     (First [ProjectVersionDescription])
     (Maybe [ProjectVersionDescription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeProjectVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeProjectVersions -> Maybe DescribeProjectVersions
forall a. a -> Maybe a
Prelude.Just (DescribeProjectVersions -> Maybe DescribeProjectVersions)
-> DescribeProjectVersions -> Maybe DescribeProjectVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeProjectVersions
rq
          DescribeProjectVersions
-> (DescribeProjectVersions -> DescribeProjectVersions)
-> DescribeProjectVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeProjectVersions -> Identity DescribeProjectVersions
Lens
  DescribeProjectVersions
  DescribeProjectVersions
  (Maybe Text)
  (Maybe Text)
describeProjectVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeProjectVersions -> Identity DescribeProjectVersions)
-> Maybe Text -> DescribeProjectVersions -> DescribeProjectVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeProjectVersions
DescribeProjectVersionsResponse
rs
          DescribeProjectVersionsResponse
-> Getting (First Text) DescribeProjectVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeProjectVersionsResponse
-> Const (First Text) DescribeProjectVersionsResponse
Lens' DescribeProjectVersionsResponse (Maybe Text)
describeProjectVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeProjectVersionsResponse
 -> Const (First Text) DescribeProjectVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeProjectVersionsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeProjectVersions where
  type
    AWSResponse DescribeProjectVersions =
      DescribeProjectVersionsResponse
  request :: DescribeProjectVersions -> Request DescribeProjectVersions
request = Service
-> DescribeProjectVersions -> Request DescribeProjectVersions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeProjectVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeProjectVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeProjectVersions))
-> Logger
-> Service
-> Proxy DescribeProjectVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeProjectVersions)))
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
-> Maybe [ProjectVersionDescription]
-> Int
-> DescribeProjectVersionsResponse
DescribeProjectVersionsResponse'
            (Maybe Text
 -> Maybe [ProjectVersionDescription]
 -> Int
 -> DescribeProjectVersionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ProjectVersionDescription]
      -> Int -> DescribeProjectVersionsResponse)
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
"NextToken")
            Either
  String
  (Maybe [ProjectVersionDescription]
   -> Int -> DescribeProjectVersionsResponse)
-> Either String (Maybe [ProjectVersionDescription])
-> Either String (Int -> DescribeProjectVersionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text
-> Either String (Maybe (Maybe [ProjectVersionDescription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProjectVersionDescriptions"
                            Either String (Maybe (Maybe [ProjectVersionDescription]))
-> Maybe [ProjectVersionDescription]
-> Either String (Maybe [ProjectVersionDescription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ProjectVersionDescription]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> DescribeProjectVersionsResponse)
-> Either String Int
-> Either String DescribeProjectVersionsResponse
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 DescribeProjectVersions

instance Prelude.NFData DescribeProjectVersions

instance Core.ToHeaders DescribeProjectVersions where
  toHeaders :: DescribeProjectVersions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeProjectVersions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"RekognitionService.DescribeProjectVersions" ::
                          Prelude.ByteString
                      ),
            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 DescribeProjectVersions where
  toJSON :: DescribeProjectVersions -> Value
toJSON DescribeProjectVersions' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
Text
projectArn :: Text
maxResults :: Maybe Natural
versionNames :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
$sel:projectArn:DescribeProjectVersions' :: DescribeProjectVersions -> Text
$sel:maxResults:DescribeProjectVersions' :: DescribeProjectVersions -> Maybe Natural
$sel:versionNames:DescribeProjectVersions' :: DescribeProjectVersions -> Maybe (NonEmpty Text)
$sel:nextToken:DescribeProjectVersions' :: DescribeProjectVersions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"VersionNames" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
versionNames,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProjectArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectArn)
          ]
      )

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

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

-- | /See:/ 'newDescribeProjectVersionsResponse' smart constructor.
data DescribeProjectVersionsResponse = DescribeProjectVersionsResponse'
  { -- | If the previous response was incomplete (because there is more results
    -- to retrieve), Amazon Rekognition Custom Labels returns a pagination
    -- token in the response. You can use this pagination token to retrieve the
    -- next set of results.
    DescribeProjectVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of model descriptions. The list is sorted by the creation date
    -- and time of the model versions, latest to earliest.
    DescribeProjectVersionsResponse
-> Maybe [ProjectVersionDescription]
projectVersionDescriptions :: Prelude.Maybe [ProjectVersionDescription],
    -- | The response's http status code.
    DescribeProjectVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeProjectVersionsResponse
-> DescribeProjectVersionsResponse -> Bool
(DescribeProjectVersionsResponse
 -> DescribeProjectVersionsResponse -> Bool)
-> (DescribeProjectVersionsResponse
    -> DescribeProjectVersionsResponse -> Bool)
-> Eq DescribeProjectVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProjectVersionsResponse
-> DescribeProjectVersionsResponse -> Bool
$c/= :: DescribeProjectVersionsResponse
-> DescribeProjectVersionsResponse -> Bool
== :: DescribeProjectVersionsResponse
-> DescribeProjectVersionsResponse -> Bool
$c== :: DescribeProjectVersionsResponse
-> DescribeProjectVersionsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeProjectVersionsResponse]
ReadPrec DescribeProjectVersionsResponse
Int -> ReadS DescribeProjectVersionsResponse
ReadS [DescribeProjectVersionsResponse]
(Int -> ReadS DescribeProjectVersionsResponse)
-> ReadS [DescribeProjectVersionsResponse]
-> ReadPrec DescribeProjectVersionsResponse
-> ReadPrec [DescribeProjectVersionsResponse]
-> Read DescribeProjectVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProjectVersionsResponse]
$creadListPrec :: ReadPrec [DescribeProjectVersionsResponse]
readPrec :: ReadPrec DescribeProjectVersionsResponse
$creadPrec :: ReadPrec DescribeProjectVersionsResponse
readList :: ReadS [DescribeProjectVersionsResponse]
$creadList :: ReadS [DescribeProjectVersionsResponse]
readsPrec :: Int -> ReadS DescribeProjectVersionsResponse
$creadsPrec :: Int -> ReadS DescribeProjectVersionsResponse
Prelude.Read, Int -> DescribeProjectVersionsResponse -> ShowS
[DescribeProjectVersionsResponse] -> ShowS
DescribeProjectVersionsResponse -> String
(Int -> DescribeProjectVersionsResponse -> ShowS)
-> (DescribeProjectVersionsResponse -> String)
-> ([DescribeProjectVersionsResponse] -> ShowS)
-> Show DescribeProjectVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProjectVersionsResponse] -> ShowS
$cshowList :: [DescribeProjectVersionsResponse] -> ShowS
show :: DescribeProjectVersionsResponse -> String
$cshow :: DescribeProjectVersionsResponse -> String
showsPrec :: Int -> DescribeProjectVersionsResponse -> ShowS
$cshowsPrec :: Int -> DescribeProjectVersionsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeProjectVersionsResponse
 -> Rep DescribeProjectVersionsResponse x)
-> (forall x.
    Rep DescribeProjectVersionsResponse x
    -> DescribeProjectVersionsResponse)
-> Generic DescribeProjectVersionsResponse
forall x.
Rep DescribeProjectVersionsResponse x
-> DescribeProjectVersionsResponse
forall x.
DescribeProjectVersionsResponse
-> Rep DescribeProjectVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeProjectVersionsResponse x
-> DescribeProjectVersionsResponse
$cfrom :: forall x.
DescribeProjectVersionsResponse
-> Rep DescribeProjectVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeProjectVersionsResponse' 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:
--
-- 'nextToken', 'describeProjectVersionsResponse_nextToken' - If the previous response was incomplete (because there is more results
-- to retrieve), Amazon Rekognition Custom Labels returns a pagination
-- token in the response. You can use this pagination token to retrieve the
-- next set of results.
--
-- 'projectVersionDescriptions', 'describeProjectVersionsResponse_projectVersionDescriptions' - A list of model descriptions. The list is sorted by the creation date
-- and time of the model versions, latest to earliest.
--
-- 'httpStatus', 'describeProjectVersionsResponse_httpStatus' - The response's http status code.
newDescribeProjectVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeProjectVersionsResponse
newDescribeProjectVersionsResponse :: Int -> DescribeProjectVersionsResponse
newDescribeProjectVersionsResponse Int
pHttpStatus_ =
  DescribeProjectVersionsResponse' :: Maybe Text
-> Maybe [ProjectVersionDescription]
-> Int
-> DescribeProjectVersionsResponse
DescribeProjectVersionsResponse'
    { $sel:nextToken:DescribeProjectVersionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:projectVersionDescriptions:DescribeProjectVersionsResponse' :: Maybe [ProjectVersionDescription]
projectVersionDescriptions =
        Maybe [ProjectVersionDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeProjectVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If the previous response was incomplete (because there is more results
-- to retrieve), Amazon Rekognition Custom Labels returns a pagination
-- token in the response. You can use this pagination token to retrieve the
-- next set of results.
describeProjectVersionsResponse_nextToken :: Lens.Lens' DescribeProjectVersionsResponse (Prelude.Maybe Prelude.Text)
describeProjectVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeProjectVersionsResponse
-> f DescribeProjectVersionsResponse
describeProjectVersionsResponse_nextToken = (DescribeProjectVersionsResponse -> Maybe Text)
-> (DescribeProjectVersionsResponse
    -> Maybe Text -> DescribeProjectVersionsResponse)
-> Lens' DescribeProjectVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeProjectVersionsResponse' :: DescribeProjectVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeProjectVersionsResponse
s@DescribeProjectVersionsResponse' {} Maybe Text
a -> DescribeProjectVersionsResponse
s {$sel:nextToken:DescribeProjectVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeProjectVersionsResponse)

-- | A list of model descriptions. The list is sorted by the creation date
-- and time of the model versions, latest to earliest.
describeProjectVersionsResponse_projectVersionDescriptions :: Lens.Lens' DescribeProjectVersionsResponse (Prelude.Maybe [ProjectVersionDescription])
describeProjectVersionsResponse_projectVersionDescriptions :: (Maybe [ProjectVersionDescription]
 -> f (Maybe [ProjectVersionDescription]))
-> DescribeProjectVersionsResponse
-> f DescribeProjectVersionsResponse
describeProjectVersionsResponse_projectVersionDescriptions = (DescribeProjectVersionsResponse
 -> Maybe [ProjectVersionDescription])
-> (DescribeProjectVersionsResponse
    -> Maybe [ProjectVersionDescription]
    -> DescribeProjectVersionsResponse)
-> Lens'
     DescribeProjectVersionsResponse (Maybe [ProjectVersionDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProjectVersionsResponse' {Maybe [ProjectVersionDescription]
projectVersionDescriptions :: Maybe [ProjectVersionDescription]
$sel:projectVersionDescriptions:DescribeProjectVersionsResponse' :: DescribeProjectVersionsResponse
-> Maybe [ProjectVersionDescription]
projectVersionDescriptions} -> Maybe [ProjectVersionDescription]
projectVersionDescriptions) (\s :: DescribeProjectVersionsResponse
s@DescribeProjectVersionsResponse' {} Maybe [ProjectVersionDescription]
a -> DescribeProjectVersionsResponse
s {$sel:projectVersionDescriptions:DescribeProjectVersionsResponse' :: Maybe [ProjectVersionDescription]
projectVersionDescriptions = Maybe [ProjectVersionDescription]
a} :: DescribeProjectVersionsResponse) ((Maybe [ProjectVersionDescription]
  -> f (Maybe [ProjectVersionDescription]))
 -> DescribeProjectVersionsResponse
 -> f DescribeProjectVersionsResponse)
-> ((Maybe [ProjectVersionDescription]
     -> f (Maybe [ProjectVersionDescription]))
    -> Maybe [ProjectVersionDescription]
    -> f (Maybe [ProjectVersionDescription]))
-> (Maybe [ProjectVersionDescription]
    -> f (Maybe [ProjectVersionDescription]))
-> DescribeProjectVersionsResponse
-> f DescribeProjectVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ProjectVersionDescription]
  [ProjectVersionDescription]
  [ProjectVersionDescription]
  [ProjectVersionDescription]
-> Iso
     (Maybe [ProjectVersionDescription])
     (Maybe [ProjectVersionDescription])
     (Maybe [ProjectVersionDescription])
     (Maybe [ProjectVersionDescription])
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 AnIso
  [ProjectVersionDescription]
  [ProjectVersionDescription]
  [ProjectVersionDescription]
  [ProjectVersionDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeProjectVersionsResponse