{-# 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 #-}
module Amazonka.GreengrassV2.ListComponentVersions
(
ListComponentVersions (..),
newListComponentVersions,
listComponentVersions_maxResults,
listComponentVersions_nextToken,
listComponentVersions_arn,
ListComponentVersionsResponse (..),
newListComponentVersionsResponse,
listComponentVersionsResponse_componentVersions,
listComponentVersionsResponse_nextToken,
listComponentVersionsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GreengrassV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListComponentVersions = ListComponentVersions'
{
ListComponentVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListComponentVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListComponentVersions -> Text
arn :: Prelude.Text
}
deriving (ListComponentVersions -> ListComponentVersions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListComponentVersions -> ListComponentVersions -> Bool
$c/= :: ListComponentVersions -> ListComponentVersions -> Bool
== :: ListComponentVersions -> ListComponentVersions -> Bool
$c== :: ListComponentVersions -> ListComponentVersions -> Bool
Prelude.Eq, ReadPrec [ListComponentVersions]
ReadPrec ListComponentVersions
Int -> ReadS ListComponentVersions
ReadS [ListComponentVersions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListComponentVersions]
$creadListPrec :: ReadPrec [ListComponentVersions]
readPrec :: ReadPrec ListComponentVersions
$creadPrec :: ReadPrec ListComponentVersions
readList :: ReadS [ListComponentVersions]
$creadList :: ReadS [ListComponentVersions]
readsPrec :: Int -> ReadS ListComponentVersions
$creadsPrec :: Int -> ReadS ListComponentVersions
Prelude.Read, Int -> ListComponentVersions -> ShowS
[ListComponentVersions] -> ShowS
ListComponentVersions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListComponentVersions] -> ShowS
$cshowList :: [ListComponentVersions] -> ShowS
show :: ListComponentVersions -> String
$cshow :: ListComponentVersions -> String
showsPrec :: Int -> ListComponentVersions -> ShowS
$cshowsPrec :: Int -> ListComponentVersions -> ShowS
Prelude.Show, forall x. Rep ListComponentVersions x -> ListComponentVersions
forall x. ListComponentVersions -> Rep ListComponentVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListComponentVersions x -> ListComponentVersions
$cfrom :: forall x. ListComponentVersions -> Rep ListComponentVersions x
Prelude.Generic)
newListComponentVersions ::
Prelude.Text ->
ListComponentVersions
newListComponentVersions :: Text -> ListComponentVersions
newListComponentVersions Text
pArn_ =
ListComponentVersions'
{ $sel:maxResults:ListComponentVersions' :: Maybe Natural
maxResults =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListComponentVersions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:arn:ListComponentVersions' :: Text
arn = Text
pArn_
}
listComponentVersions_maxResults :: Lens.Lens' ListComponentVersions (Prelude.Maybe Prelude.Natural)
listComponentVersions_maxResults :: Lens' ListComponentVersions (Maybe Natural)
listComponentVersions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComponentVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListComponentVersions' :: ListComponentVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListComponentVersions
s@ListComponentVersions' {} Maybe Natural
a -> ListComponentVersions
s {$sel:maxResults:ListComponentVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListComponentVersions)
listComponentVersions_nextToken :: Lens.Lens' ListComponentVersions (Prelude.Maybe Prelude.Text)
listComponentVersions_nextToken :: Lens' ListComponentVersions (Maybe Text)
listComponentVersions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComponentVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListComponentVersions' :: ListComponentVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListComponentVersions
s@ListComponentVersions' {} Maybe Text
a -> ListComponentVersions
s {$sel:nextToken:ListComponentVersions' :: Maybe Text
nextToken = Maybe Text
a} :: ListComponentVersions)
listComponentVersions_arn :: Lens.Lens' ListComponentVersions Prelude.Text
listComponentVersions_arn :: Lens' ListComponentVersions Text
listComponentVersions_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComponentVersions' {Text
arn :: Text
$sel:arn:ListComponentVersions' :: ListComponentVersions -> Text
arn} -> Text
arn) (\s :: ListComponentVersions
s@ListComponentVersions' {} Text
a -> ListComponentVersions
s {$sel:arn:ListComponentVersions' :: Text
arn = Text
a} :: ListComponentVersions)
instance Core.AWSPager ListComponentVersions where
page :: ListComponentVersions
-> AWSResponse ListComponentVersions -> Maybe ListComponentVersions
page ListComponentVersions
rq AWSResponse ListComponentVersions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListComponentVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListComponentVersionsResponse (Maybe Text)
listComponentVersionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListComponentVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
ListComponentVersionsResponse (Maybe [ComponentVersionListItem])
listComponentVersionsResponse_componentVersions
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListComponentVersions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListComponentVersions (Maybe Text)
listComponentVersions_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListComponentVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListComponentVersionsResponse (Maybe Text)
listComponentVersionsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListComponentVersions where
type
AWSResponse ListComponentVersions =
ListComponentVersionsResponse
request :: (Service -> Service)
-> ListComponentVersions -> Request ListComponentVersions
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 ListComponentVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListComponentVersions)))
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 [ComponentVersionListItem]
-> Maybe Text -> Int -> ListComponentVersionsResponse
ListComponentVersionsResponse'
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
"componentVersions"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
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 ListComponentVersions where
hashWithSalt :: Int -> ListComponentVersions -> Int
hashWithSalt Int
_salt ListComponentVersions' {Maybe Natural
Maybe Text
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:arn:ListComponentVersions' :: ListComponentVersions -> Text
$sel:nextToken:ListComponentVersions' :: ListComponentVersions -> Maybe Text
$sel:maxResults:ListComponentVersions' :: ListComponentVersions -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn
instance Prelude.NFData ListComponentVersions where
rnf :: ListComponentVersions -> ()
rnf ListComponentVersions' {Maybe Natural
Maybe Text
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:arn:ListComponentVersions' :: ListComponentVersions -> Text
$sel:nextToken:ListComponentVersions' :: ListComponentVersions -> Maybe Text
$sel:maxResults:ListComponentVersions' :: ListComponentVersions -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
instance Data.ToHeaders ListComponentVersions where
toHeaders :: ListComponentVersions -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListComponentVersions where
toPath :: ListComponentVersions -> ByteString
toPath ListComponentVersions' {Maybe Natural
Maybe Text
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:arn:ListComponentVersions' :: ListComponentVersions -> Text
$sel:nextToken:ListComponentVersions' :: ListComponentVersions -> Maybe Text
$sel:maxResults:ListComponentVersions' :: ListComponentVersions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/v2/components/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
arn,
ByteString
"/versions"
]
instance Data.ToQuery ListComponentVersions where
toQuery :: ListComponentVersions -> QueryString
toQuery ListComponentVersions' {Maybe Natural
Maybe Text
Text
arn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:arn:ListComponentVersions' :: ListComponentVersions -> Text
$sel:nextToken:ListComponentVersions' :: ListComponentVersions -> Maybe Text
$sel:maxResults:ListComponentVersions' :: ListComponentVersions -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListComponentVersionsResponse = ListComponentVersionsResponse'
{
ListComponentVersionsResponse -> Maybe [ComponentVersionListItem]
componentVersions :: Prelude.Maybe [ComponentVersionListItem],
ListComponentVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListComponentVersionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListComponentVersionsResponse
-> ListComponentVersionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListComponentVersionsResponse
-> ListComponentVersionsResponse -> Bool
$c/= :: ListComponentVersionsResponse
-> ListComponentVersionsResponse -> Bool
== :: ListComponentVersionsResponse
-> ListComponentVersionsResponse -> Bool
$c== :: ListComponentVersionsResponse
-> ListComponentVersionsResponse -> Bool
Prelude.Eq, ReadPrec [ListComponentVersionsResponse]
ReadPrec ListComponentVersionsResponse
Int -> ReadS ListComponentVersionsResponse
ReadS [ListComponentVersionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListComponentVersionsResponse]
$creadListPrec :: ReadPrec [ListComponentVersionsResponse]
readPrec :: ReadPrec ListComponentVersionsResponse
$creadPrec :: ReadPrec ListComponentVersionsResponse
readList :: ReadS [ListComponentVersionsResponse]
$creadList :: ReadS [ListComponentVersionsResponse]
readsPrec :: Int -> ReadS ListComponentVersionsResponse
$creadsPrec :: Int -> ReadS ListComponentVersionsResponse
Prelude.Read, Int -> ListComponentVersionsResponse -> ShowS
[ListComponentVersionsResponse] -> ShowS
ListComponentVersionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListComponentVersionsResponse] -> ShowS
$cshowList :: [ListComponentVersionsResponse] -> ShowS
show :: ListComponentVersionsResponse -> String
$cshow :: ListComponentVersionsResponse -> String
showsPrec :: Int -> ListComponentVersionsResponse -> ShowS
$cshowsPrec :: Int -> ListComponentVersionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListComponentVersionsResponse x
-> ListComponentVersionsResponse
forall x.
ListComponentVersionsResponse
-> Rep ListComponentVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListComponentVersionsResponse x
-> ListComponentVersionsResponse
$cfrom :: forall x.
ListComponentVersionsResponse
-> Rep ListComponentVersionsResponse x
Prelude.Generic)
newListComponentVersionsResponse ::
Prelude.Int ->
ListComponentVersionsResponse
newListComponentVersionsResponse :: Int -> ListComponentVersionsResponse
newListComponentVersionsResponse Int
pHttpStatus_ =
ListComponentVersionsResponse'
{ $sel:componentVersions:ListComponentVersionsResponse' :: Maybe [ComponentVersionListItem]
componentVersions =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListComponentVersionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListComponentVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listComponentVersionsResponse_componentVersions :: Lens.Lens' ListComponentVersionsResponse (Prelude.Maybe [ComponentVersionListItem])
listComponentVersionsResponse_componentVersions :: Lens'
ListComponentVersionsResponse (Maybe [ComponentVersionListItem])
listComponentVersionsResponse_componentVersions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComponentVersionsResponse' {Maybe [ComponentVersionListItem]
componentVersions :: Maybe [ComponentVersionListItem]
$sel:componentVersions:ListComponentVersionsResponse' :: ListComponentVersionsResponse -> Maybe [ComponentVersionListItem]
componentVersions} -> Maybe [ComponentVersionListItem]
componentVersions) (\s :: ListComponentVersionsResponse
s@ListComponentVersionsResponse' {} Maybe [ComponentVersionListItem]
a -> ListComponentVersionsResponse
s {$sel:componentVersions:ListComponentVersionsResponse' :: Maybe [ComponentVersionListItem]
componentVersions = Maybe [ComponentVersionListItem]
a} :: ListComponentVersionsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listComponentVersionsResponse_nextToken :: Lens.Lens' ListComponentVersionsResponse (Prelude.Maybe Prelude.Text)
listComponentVersionsResponse_nextToken :: Lens' ListComponentVersionsResponse (Maybe Text)
listComponentVersionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComponentVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListComponentVersionsResponse' :: ListComponentVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListComponentVersionsResponse
s@ListComponentVersionsResponse' {} Maybe Text
a -> ListComponentVersionsResponse
s {$sel:nextToken:ListComponentVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListComponentVersionsResponse)
listComponentVersionsResponse_httpStatus :: Lens.Lens' ListComponentVersionsResponse Prelude.Int
listComponentVersionsResponse_httpStatus :: Lens' ListComponentVersionsResponse Int
listComponentVersionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListComponentVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListComponentVersionsResponse' :: ListComponentVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListComponentVersionsResponse
s@ListComponentVersionsResponse' {} Int
a -> ListComponentVersionsResponse
s {$sel:httpStatus:ListComponentVersionsResponse' :: Int
httpStatus = Int
a} :: ListComponentVersionsResponse)
instance Prelude.NFData ListComponentVersionsResponse where
rnf :: ListComponentVersionsResponse -> ()
rnf ListComponentVersionsResponse' {Int
Maybe [ComponentVersionListItem]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
componentVersions :: Maybe [ComponentVersionListItem]
$sel:httpStatus:ListComponentVersionsResponse' :: ListComponentVersionsResponse -> Int
$sel:nextToken:ListComponentVersionsResponse' :: ListComponentVersionsResponse -> Maybe Text
$sel:componentVersions:ListComponentVersionsResponse' :: ListComponentVersionsResponse -> Maybe [ComponentVersionListItem]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ComponentVersionListItem]
componentVersions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus