{-# 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.Greengrass.ListSubscriptionDefinitionVersions
-- 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 the versions of a subscription definition.
--
-- This operation returns paginated results.
module Amazonka.Greengrass.ListSubscriptionDefinitionVersions
  ( -- * Creating a Request
    ListSubscriptionDefinitionVersions (..),
    newListSubscriptionDefinitionVersions,

    -- * Request Lenses
    listSubscriptionDefinitionVersions_nextToken,
    listSubscriptionDefinitionVersions_maxResults,
    listSubscriptionDefinitionVersions_subscriptionDefinitionId,

    -- * Destructuring the Response
    ListSubscriptionDefinitionVersionsResponse (..),
    newListSubscriptionDefinitionVersionsResponse,

    -- * Response Lenses
    listSubscriptionDefinitionVersionsResponse_versions,
    listSubscriptionDefinitionVersionsResponse_nextToken,
    listSubscriptionDefinitionVersionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListSubscriptionDefinitionVersions' smart constructor.
data ListSubscriptionDefinitionVersions = ListSubscriptionDefinitionVersions'
  { -- | The token for the next set of results, or \'\'null\'\' if there are no
    -- additional results.
    ListSubscriptionDefinitionVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    ListSubscriptionDefinitionVersions -> Maybe Text
maxResults :: Prelude.Maybe Prelude.Text,
    -- | The ID of the subscription definition.
    ListSubscriptionDefinitionVersions -> Text
subscriptionDefinitionId :: Prelude.Text
  }
  deriving (ListSubscriptionDefinitionVersions
-> ListSubscriptionDefinitionVersions -> Bool
(ListSubscriptionDefinitionVersions
 -> ListSubscriptionDefinitionVersions -> Bool)
-> (ListSubscriptionDefinitionVersions
    -> ListSubscriptionDefinitionVersions -> Bool)
-> Eq ListSubscriptionDefinitionVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSubscriptionDefinitionVersions
-> ListSubscriptionDefinitionVersions -> Bool
$c/= :: ListSubscriptionDefinitionVersions
-> ListSubscriptionDefinitionVersions -> Bool
== :: ListSubscriptionDefinitionVersions
-> ListSubscriptionDefinitionVersions -> Bool
$c== :: ListSubscriptionDefinitionVersions
-> ListSubscriptionDefinitionVersions -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionDefinitionVersions]
ReadPrec ListSubscriptionDefinitionVersions
Int -> ReadS ListSubscriptionDefinitionVersions
ReadS [ListSubscriptionDefinitionVersions]
(Int -> ReadS ListSubscriptionDefinitionVersions)
-> ReadS [ListSubscriptionDefinitionVersions]
-> ReadPrec ListSubscriptionDefinitionVersions
-> ReadPrec [ListSubscriptionDefinitionVersions]
-> Read ListSubscriptionDefinitionVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSubscriptionDefinitionVersions]
$creadListPrec :: ReadPrec [ListSubscriptionDefinitionVersions]
readPrec :: ReadPrec ListSubscriptionDefinitionVersions
$creadPrec :: ReadPrec ListSubscriptionDefinitionVersions
readList :: ReadS [ListSubscriptionDefinitionVersions]
$creadList :: ReadS [ListSubscriptionDefinitionVersions]
readsPrec :: Int -> ReadS ListSubscriptionDefinitionVersions
$creadsPrec :: Int -> ReadS ListSubscriptionDefinitionVersions
Prelude.Read, Int -> ListSubscriptionDefinitionVersions -> ShowS
[ListSubscriptionDefinitionVersions] -> ShowS
ListSubscriptionDefinitionVersions -> String
(Int -> ListSubscriptionDefinitionVersions -> ShowS)
-> (ListSubscriptionDefinitionVersions -> String)
-> ([ListSubscriptionDefinitionVersions] -> ShowS)
-> Show ListSubscriptionDefinitionVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSubscriptionDefinitionVersions] -> ShowS
$cshowList :: [ListSubscriptionDefinitionVersions] -> ShowS
show :: ListSubscriptionDefinitionVersions -> String
$cshow :: ListSubscriptionDefinitionVersions -> String
showsPrec :: Int -> ListSubscriptionDefinitionVersions -> ShowS
$cshowsPrec :: Int -> ListSubscriptionDefinitionVersions -> ShowS
Prelude.Show, (forall x.
 ListSubscriptionDefinitionVersions
 -> Rep ListSubscriptionDefinitionVersions x)
-> (forall x.
    Rep ListSubscriptionDefinitionVersions x
    -> ListSubscriptionDefinitionVersions)
-> Generic ListSubscriptionDefinitionVersions
forall x.
Rep ListSubscriptionDefinitionVersions x
-> ListSubscriptionDefinitionVersions
forall x.
ListSubscriptionDefinitionVersions
-> Rep ListSubscriptionDefinitionVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSubscriptionDefinitionVersions x
-> ListSubscriptionDefinitionVersions
$cfrom :: forall x.
ListSubscriptionDefinitionVersions
-> Rep ListSubscriptionDefinitionVersions x
Prelude.Generic)

-- |
-- Create a value of 'ListSubscriptionDefinitionVersions' 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', 'listSubscriptionDefinitionVersions_nextToken' - The token for the next set of results, or \'\'null\'\' if there are no
-- additional results.
--
-- 'maxResults', 'listSubscriptionDefinitionVersions_maxResults' - The maximum number of results to be returned per request.
--
-- 'subscriptionDefinitionId', 'listSubscriptionDefinitionVersions_subscriptionDefinitionId' - The ID of the subscription definition.
newListSubscriptionDefinitionVersions ::
  -- | 'subscriptionDefinitionId'
  Prelude.Text ->
  ListSubscriptionDefinitionVersions
newListSubscriptionDefinitionVersions :: Text -> ListSubscriptionDefinitionVersions
newListSubscriptionDefinitionVersions
  Text
pSubscriptionDefinitionId_ =
    ListSubscriptionDefinitionVersions' :: Maybe Text
-> Maybe Text -> Text -> ListSubscriptionDefinitionVersions
ListSubscriptionDefinitionVersions'
      { $sel:nextToken:ListSubscriptionDefinitionVersions' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListSubscriptionDefinitionVersions' :: Maybe Text
maxResults = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:subscriptionDefinitionId:ListSubscriptionDefinitionVersions' :: Text
subscriptionDefinitionId =
          Text
pSubscriptionDefinitionId_
      }

-- | The token for the next set of results, or \'\'null\'\' if there are no
-- additional results.
listSubscriptionDefinitionVersions_nextToken :: Lens.Lens' ListSubscriptionDefinitionVersions (Prelude.Maybe Prelude.Text)
listSubscriptionDefinitionVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSubscriptionDefinitionVersions
-> f ListSubscriptionDefinitionVersions
listSubscriptionDefinitionVersions_nextToken = (ListSubscriptionDefinitionVersions -> Maybe Text)
-> (ListSubscriptionDefinitionVersions
    -> Maybe Text -> ListSubscriptionDefinitionVersions)
-> Lens
     ListSubscriptionDefinitionVersions
     ListSubscriptionDefinitionVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionDefinitionVersions
s@ListSubscriptionDefinitionVersions' {} Maybe Text
a -> ListSubscriptionDefinitionVersions
s {$sel:nextToken:ListSubscriptionDefinitionVersions' :: Maybe Text
nextToken = Maybe Text
a} :: ListSubscriptionDefinitionVersions)

-- | The maximum number of results to be returned per request.
listSubscriptionDefinitionVersions_maxResults :: Lens.Lens' ListSubscriptionDefinitionVersions (Prelude.Maybe Prelude.Text)
listSubscriptionDefinitionVersions_maxResults :: (Maybe Text -> f (Maybe Text))
-> ListSubscriptionDefinitionVersions
-> f ListSubscriptionDefinitionVersions
listSubscriptionDefinitionVersions_maxResults = (ListSubscriptionDefinitionVersions -> Maybe Text)
-> (ListSubscriptionDefinitionVersions
    -> Maybe Text -> ListSubscriptionDefinitionVersions)
-> Lens
     ListSubscriptionDefinitionVersions
     ListSubscriptionDefinitionVersions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionVersions' {Maybe Text
maxResults :: Maybe Text
$sel:maxResults:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Maybe Text
maxResults} -> Maybe Text
maxResults) (\s :: ListSubscriptionDefinitionVersions
s@ListSubscriptionDefinitionVersions' {} Maybe Text
a -> ListSubscriptionDefinitionVersions
s {$sel:maxResults:ListSubscriptionDefinitionVersions' :: Maybe Text
maxResults = Maybe Text
a} :: ListSubscriptionDefinitionVersions)

-- | The ID of the subscription definition.
listSubscriptionDefinitionVersions_subscriptionDefinitionId :: Lens.Lens' ListSubscriptionDefinitionVersions Prelude.Text
listSubscriptionDefinitionVersions_subscriptionDefinitionId :: (Text -> f Text)
-> ListSubscriptionDefinitionVersions
-> f ListSubscriptionDefinitionVersions
listSubscriptionDefinitionVersions_subscriptionDefinitionId = (ListSubscriptionDefinitionVersions -> Text)
-> (ListSubscriptionDefinitionVersions
    -> Text -> ListSubscriptionDefinitionVersions)
-> Lens
     ListSubscriptionDefinitionVersions
     ListSubscriptionDefinitionVersions
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionVersions' {Text
subscriptionDefinitionId :: Text
$sel:subscriptionDefinitionId:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Text
subscriptionDefinitionId} -> Text
subscriptionDefinitionId) (\s :: ListSubscriptionDefinitionVersions
s@ListSubscriptionDefinitionVersions' {} Text
a -> ListSubscriptionDefinitionVersions
s {$sel:subscriptionDefinitionId:ListSubscriptionDefinitionVersions' :: Text
subscriptionDefinitionId = Text
a} :: ListSubscriptionDefinitionVersions)

instance
  Core.AWSPager
    ListSubscriptionDefinitionVersions
  where
  page :: ListSubscriptionDefinitionVersions
-> AWSResponse ListSubscriptionDefinitionVersions
-> Maybe ListSubscriptionDefinitionVersions
page ListSubscriptionDefinitionVersions
rq AWSResponse ListSubscriptionDefinitionVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSubscriptionDefinitionVersions
ListSubscriptionDefinitionVersionsResponse
rs
            ListSubscriptionDefinitionVersionsResponse
-> Getting
     (First Text) ListSubscriptionDefinitionVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSubscriptionDefinitionVersionsResponse
-> Const (First Text) ListSubscriptionDefinitionVersionsResponse
Lens' ListSubscriptionDefinitionVersionsResponse (Maybe Text)
listSubscriptionDefinitionVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSubscriptionDefinitionVersionsResponse
 -> Const (First Text) ListSubscriptionDefinitionVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListSubscriptionDefinitionVersionsResponse 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 ListSubscriptionDefinitionVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [VersionInformation] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSubscriptionDefinitionVersions
ListSubscriptionDefinitionVersionsResponse
rs
            ListSubscriptionDefinitionVersionsResponse
-> Getting
     (First [VersionInformation])
     ListSubscriptionDefinitionVersionsResponse
     [VersionInformation]
-> Maybe [VersionInformation]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [VersionInformation]
 -> Const (First [VersionInformation]) (Maybe [VersionInformation]))
-> ListSubscriptionDefinitionVersionsResponse
-> Const
     (First [VersionInformation])
     ListSubscriptionDefinitionVersionsResponse
Lens'
  ListSubscriptionDefinitionVersionsResponse
  (Maybe [VersionInformation])
listSubscriptionDefinitionVersionsResponse_versions
              ((Maybe [VersionInformation]
  -> Const (First [VersionInformation]) (Maybe [VersionInformation]))
 -> ListSubscriptionDefinitionVersionsResponse
 -> Const
      (First [VersionInformation])
      ListSubscriptionDefinitionVersionsResponse)
-> (([VersionInformation]
     -> Const (First [VersionInformation]) [VersionInformation])
    -> Maybe [VersionInformation]
    -> Const (First [VersionInformation]) (Maybe [VersionInformation]))
-> Getting
     (First [VersionInformation])
     ListSubscriptionDefinitionVersionsResponse
     [VersionInformation]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([VersionInformation]
 -> Const (First [VersionInformation]) [VersionInformation])
-> Maybe [VersionInformation]
-> Const (First [VersionInformation]) (Maybe [VersionInformation])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListSubscriptionDefinitionVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSubscriptionDefinitionVersions
-> Maybe ListSubscriptionDefinitionVersions
forall a. a -> Maybe a
Prelude.Just (ListSubscriptionDefinitionVersions
 -> Maybe ListSubscriptionDefinitionVersions)
-> ListSubscriptionDefinitionVersions
-> Maybe ListSubscriptionDefinitionVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSubscriptionDefinitionVersions
rq
          ListSubscriptionDefinitionVersions
-> (ListSubscriptionDefinitionVersions
    -> ListSubscriptionDefinitionVersions)
-> ListSubscriptionDefinitionVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSubscriptionDefinitionVersions
-> Identity ListSubscriptionDefinitionVersions
Lens
  ListSubscriptionDefinitionVersions
  ListSubscriptionDefinitionVersions
  (Maybe Text)
  (Maybe Text)
listSubscriptionDefinitionVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSubscriptionDefinitionVersions
 -> Identity ListSubscriptionDefinitionVersions)
-> Maybe Text
-> ListSubscriptionDefinitionVersions
-> ListSubscriptionDefinitionVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSubscriptionDefinitionVersions
ListSubscriptionDefinitionVersionsResponse
rs
          ListSubscriptionDefinitionVersionsResponse
-> Getting
     (First Text) ListSubscriptionDefinitionVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSubscriptionDefinitionVersionsResponse
-> Const (First Text) ListSubscriptionDefinitionVersionsResponse
Lens' ListSubscriptionDefinitionVersionsResponse (Maybe Text)
listSubscriptionDefinitionVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSubscriptionDefinitionVersionsResponse
 -> Const (First Text) ListSubscriptionDefinitionVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting
     (First Text) ListSubscriptionDefinitionVersionsResponse 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
    ListSubscriptionDefinitionVersions
  where
  type
    AWSResponse ListSubscriptionDefinitionVersions =
      ListSubscriptionDefinitionVersionsResponse
  request :: ListSubscriptionDefinitionVersions
-> Request ListSubscriptionDefinitionVersions
request = Service
-> ListSubscriptionDefinitionVersions
-> Request ListSubscriptionDefinitionVersions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSubscriptionDefinitionVersions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListSubscriptionDefinitionVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListSubscriptionDefinitionVersions))
-> Logger
-> Service
-> Proxy ListSubscriptionDefinitionVersions
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse ListSubscriptionDefinitionVersions)))
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 [VersionInformation]
-> Maybe Text -> Int -> ListSubscriptionDefinitionVersionsResponse
ListSubscriptionDefinitionVersionsResponse'
            (Maybe [VersionInformation]
 -> Maybe Text -> Int -> ListSubscriptionDefinitionVersionsResponse)
-> Either String (Maybe [VersionInformation])
-> Either
     String
     (Maybe Text -> Int -> ListSubscriptionDefinitionVersionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe (Maybe [VersionInformation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Versions" Either String (Maybe (Maybe [VersionInformation]))
-> Maybe [VersionInformation]
-> Either String (Maybe [VersionInformation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [VersionInformation]
forall a. Monoid a => a
Prelude.mempty)
              Either
  String
  (Maybe Text -> Int -> ListSubscriptionDefinitionVersionsResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> ListSubscriptionDefinitionVersionsResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListSubscriptionDefinitionVersionsResponse)
-> Either String Int
-> Either String ListSubscriptionDefinitionVersionsResponse
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
    ListSubscriptionDefinitionVersions

instance
  Prelude.NFData
    ListSubscriptionDefinitionVersions

instance
  Core.ToHeaders
    ListSubscriptionDefinitionVersions
  where
  toHeaders :: ListSubscriptionDefinitionVersions -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> ListSubscriptionDefinitionVersions -> 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
    ListSubscriptionDefinitionVersions
  where
  toPath :: ListSubscriptionDefinitionVersions -> ByteString
toPath ListSubscriptionDefinitionVersions' {Maybe Text
Text
subscriptionDefinitionId :: Text
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:subscriptionDefinitionId:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Text
$sel:maxResults:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Maybe Text
$sel:nextToken:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/greengrass/definition/subscriptions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
subscriptionDefinitionId,
        ByteString
"/versions"
      ]

instance
  Core.ToQuery
    ListSubscriptionDefinitionVersions
  where
  toQuery :: ListSubscriptionDefinitionVersions -> QueryString
toQuery ListSubscriptionDefinitionVersions' {Maybe Text
Text
subscriptionDefinitionId :: Text
maxResults :: Maybe Text
nextToken :: Maybe Text
$sel:subscriptionDefinitionId:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Text
$sel:maxResults:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Maybe Text
$sel:nextToken:ListSubscriptionDefinitionVersions' :: ListSubscriptionDefinitionVersions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"MaxResults" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
maxResults
      ]

-- | /See:/ 'newListSubscriptionDefinitionVersionsResponse' smart constructor.
data ListSubscriptionDefinitionVersionsResponse = ListSubscriptionDefinitionVersionsResponse'
  { -- | Information about a version.
    ListSubscriptionDefinitionVersionsResponse
-> Maybe [VersionInformation]
versions :: Prelude.Maybe [VersionInformation],
    -- | The token for the next set of results, or \'\'null\'\' if there are no
    -- additional results.
    ListSubscriptionDefinitionVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListSubscriptionDefinitionVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSubscriptionDefinitionVersionsResponse
-> ListSubscriptionDefinitionVersionsResponse -> Bool
(ListSubscriptionDefinitionVersionsResponse
 -> ListSubscriptionDefinitionVersionsResponse -> Bool)
-> (ListSubscriptionDefinitionVersionsResponse
    -> ListSubscriptionDefinitionVersionsResponse -> Bool)
-> Eq ListSubscriptionDefinitionVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSubscriptionDefinitionVersionsResponse
-> ListSubscriptionDefinitionVersionsResponse -> Bool
$c/= :: ListSubscriptionDefinitionVersionsResponse
-> ListSubscriptionDefinitionVersionsResponse -> Bool
== :: ListSubscriptionDefinitionVersionsResponse
-> ListSubscriptionDefinitionVersionsResponse -> Bool
$c== :: ListSubscriptionDefinitionVersionsResponse
-> ListSubscriptionDefinitionVersionsResponse -> Bool
Prelude.Eq, ReadPrec [ListSubscriptionDefinitionVersionsResponse]
ReadPrec ListSubscriptionDefinitionVersionsResponse
Int -> ReadS ListSubscriptionDefinitionVersionsResponse
ReadS [ListSubscriptionDefinitionVersionsResponse]
(Int -> ReadS ListSubscriptionDefinitionVersionsResponse)
-> ReadS [ListSubscriptionDefinitionVersionsResponse]
-> ReadPrec ListSubscriptionDefinitionVersionsResponse
-> ReadPrec [ListSubscriptionDefinitionVersionsResponse]
-> Read ListSubscriptionDefinitionVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSubscriptionDefinitionVersionsResponse]
$creadListPrec :: ReadPrec [ListSubscriptionDefinitionVersionsResponse]
readPrec :: ReadPrec ListSubscriptionDefinitionVersionsResponse
$creadPrec :: ReadPrec ListSubscriptionDefinitionVersionsResponse
readList :: ReadS [ListSubscriptionDefinitionVersionsResponse]
$creadList :: ReadS [ListSubscriptionDefinitionVersionsResponse]
readsPrec :: Int -> ReadS ListSubscriptionDefinitionVersionsResponse
$creadsPrec :: Int -> ReadS ListSubscriptionDefinitionVersionsResponse
Prelude.Read, Int -> ListSubscriptionDefinitionVersionsResponse -> ShowS
[ListSubscriptionDefinitionVersionsResponse] -> ShowS
ListSubscriptionDefinitionVersionsResponse -> String
(Int -> ListSubscriptionDefinitionVersionsResponse -> ShowS)
-> (ListSubscriptionDefinitionVersionsResponse -> String)
-> ([ListSubscriptionDefinitionVersionsResponse] -> ShowS)
-> Show ListSubscriptionDefinitionVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSubscriptionDefinitionVersionsResponse] -> ShowS
$cshowList :: [ListSubscriptionDefinitionVersionsResponse] -> ShowS
show :: ListSubscriptionDefinitionVersionsResponse -> String
$cshow :: ListSubscriptionDefinitionVersionsResponse -> String
showsPrec :: Int -> ListSubscriptionDefinitionVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListSubscriptionDefinitionVersionsResponse -> ShowS
Prelude.Show, (forall x.
 ListSubscriptionDefinitionVersionsResponse
 -> Rep ListSubscriptionDefinitionVersionsResponse x)
-> (forall x.
    Rep ListSubscriptionDefinitionVersionsResponse x
    -> ListSubscriptionDefinitionVersionsResponse)
-> Generic ListSubscriptionDefinitionVersionsResponse
forall x.
Rep ListSubscriptionDefinitionVersionsResponse x
-> ListSubscriptionDefinitionVersionsResponse
forall x.
ListSubscriptionDefinitionVersionsResponse
-> Rep ListSubscriptionDefinitionVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSubscriptionDefinitionVersionsResponse x
-> ListSubscriptionDefinitionVersionsResponse
$cfrom :: forall x.
ListSubscriptionDefinitionVersionsResponse
-> Rep ListSubscriptionDefinitionVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSubscriptionDefinitionVersionsResponse' 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:
--
-- 'versions', 'listSubscriptionDefinitionVersionsResponse_versions' - Information about a version.
--
-- 'nextToken', 'listSubscriptionDefinitionVersionsResponse_nextToken' - The token for the next set of results, or \'\'null\'\' if there are no
-- additional results.
--
-- 'httpStatus', 'listSubscriptionDefinitionVersionsResponse_httpStatus' - The response's http status code.
newListSubscriptionDefinitionVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSubscriptionDefinitionVersionsResponse
newListSubscriptionDefinitionVersionsResponse :: Int -> ListSubscriptionDefinitionVersionsResponse
newListSubscriptionDefinitionVersionsResponse
  Int
pHttpStatus_ =
    ListSubscriptionDefinitionVersionsResponse' :: Maybe [VersionInformation]
-> Maybe Text -> Int -> ListSubscriptionDefinitionVersionsResponse
ListSubscriptionDefinitionVersionsResponse'
      { $sel:versions:ListSubscriptionDefinitionVersionsResponse' :: Maybe [VersionInformation]
versions =
          Maybe [VersionInformation]
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListSubscriptionDefinitionVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:ListSubscriptionDefinitionVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about a version.
listSubscriptionDefinitionVersionsResponse_versions :: Lens.Lens' ListSubscriptionDefinitionVersionsResponse (Prelude.Maybe [VersionInformation])
listSubscriptionDefinitionVersionsResponse_versions :: (Maybe [VersionInformation] -> f (Maybe [VersionInformation]))
-> ListSubscriptionDefinitionVersionsResponse
-> f ListSubscriptionDefinitionVersionsResponse
listSubscriptionDefinitionVersionsResponse_versions = (ListSubscriptionDefinitionVersionsResponse
 -> Maybe [VersionInformation])
-> (ListSubscriptionDefinitionVersionsResponse
    -> Maybe [VersionInformation]
    -> ListSubscriptionDefinitionVersionsResponse)
-> Lens'
     ListSubscriptionDefinitionVersionsResponse
     (Maybe [VersionInformation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionVersionsResponse' {Maybe [VersionInformation]
versions :: Maybe [VersionInformation]
$sel:versions:ListSubscriptionDefinitionVersionsResponse' :: ListSubscriptionDefinitionVersionsResponse
-> Maybe [VersionInformation]
versions} -> Maybe [VersionInformation]
versions) (\s :: ListSubscriptionDefinitionVersionsResponse
s@ListSubscriptionDefinitionVersionsResponse' {} Maybe [VersionInformation]
a -> ListSubscriptionDefinitionVersionsResponse
s {$sel:versions:ListSubscriptionDefinitionVersionsResponse' :: Maybe [VersionInformation]
versions = Maybe [VersionInformation]
a} :: ListSubscriptionDefinitionVersionsResponse) ((Maybe [VersionInformation] -> f (Maybe [VersionInformation]))
 -> ListSubscriptionDefinitionVersionsResponse
 -> f ListSubscriptionDefinitionVersionsResponse)
-> ((Maybe [VersionInformation] -> f (Maybe [VersionInformation]))
    -> Maybe [VersionInformation] -> f (Maybe [VersionInformation]))
-> (Maybe [VersionInformation] -> f (Maybe [VersionInformation]))
-> ListSubscriptionDefinitionVersionsResponse
-> f ListSubscriptionDefinitionVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [VersionInformation]
  [VersionInformation]
  [VersionInformation]
  [VersionInformation]
-> Iso
     (Maybe [VersionInformation])
     (Maybe [VersionInformation])
     (Maybe [VersionInformation])
     (Maybe [VersionInformation])
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
  [VersionInformation]
  [VersionInformation]
  [VersionInformation]
  [VersionInformation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of results, or \'\'null\'\' if there are no
-- additional results.
listSubscriptionDefinitionVersionsResponse_nextToken :: Lens.Lens' ListSubscriptionDefinitionVersionsResponse (Prelude.Maybe Prelude.Text)
listSubscriptionDefinitionVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSubscriptionDefinitionVersionsResponse
-> f ListSubscriptionDefinitionVersionsResponse
listSubscriptionDefinitionVersionsResponse_nextToken = (ListSubscriptionDefinitionVersionsResponse -> Maybe Text)
-> (ListSubscriptionDefinitionVersionsResponse
    -> Maybe Text -> ListSubscriptionDefinitionVersionsResponse)
-> Lens' ListSubscriptionDefinitionVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSubscriptionDefinitionVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSubscriptionDefinitionVersionsResponse' :: ListSubscriptionDefinitionVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSubscriptionDefinitionVersionsResponse
s@ListSubscriptionDefinitionVersionsResponse' {} Maybe Text
a -> ListSubscriptionDefinitionVersionsResponse
s {$sel:nextToken:ListSubscriptionDefinitionVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSubscriptionDefinitionVersionsResponse)

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

instance
  Prelude.NFData
    ListSubscriptionDefinitionVersionsResponse