{-# 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.IoTRoboRunner.ListDestinations
(
ListDestinations (..),
newListDestinations,
listDestinations_maxResults,
listDestinations_nextToken,
listDestinations_state,
listDestinations_site,
ListDestinationsResponse (..),
newListDestinationsResponse,
listDestinationsResponse_destinations,
listDestinationsResponse_nextToken,
listDestinationsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTRoboRunner.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListDestinations = ListDestinations'
{ ListDestinations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDestinations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDestinations -> Maybe DestinationState
state :: Prelude.Maybe DestinationState,
ListDestinations -> Text
site :: Prelude.Text
}
deriving (ListDestinations -> ListDestinations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDestinations -> ListDestinations -> Bool
$c/= :: ListDestinations -> ListDestinations -> Bool
== :: ListDestinations -> ListDestinations -> Bool
$c== :: ListDestinations -> ListDestinations -> Bool
Prelude.Eq, ReadPrec [ListDestinations]
ReadPrec ListDestinations
Int -> ReadS ListDestinations
ReadS [ListDestinations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDestinations]
$creadListPrec :: ReadPrec [ListDestinations]
readPrec :: ReadPrec ListDestinations
$creadPrec :: ReadPrec ListDestinations
readList :: ReadS [ListDestinations]
$creadList :: ReadS [ListDestinations]
readsPrec :: Int -> ReadS ListDestinations
$creadsPrec :: Int -> ReadS ListDestinations
Prelude.Read, Int -> ListDestinations -> ShowS
[ListDestinations] -> ShowS
ListDestinations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDestinations] -> ShowS
$cshowList :: [ListDestinations] -> ShowS
show :: ListDestinations -> String
$cshow :: ListDestinations -> String
showsPrec :: Int -> ListDestinations -> ShowS
$cshowsPrec :: Int -> ListDestinations -> ShowS
Prelude.Show, forall x. Rep ListDestinations x -> ListDestinations
forall x. ListDestinations -> Rep ListDestinations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDestinations x -> ListDestinations
$cfrom :: forall x. ListDestinations -> Rep ListDestinations x
Prelude.Generic)
newListDestinations ::
Prelude.Text ->
ListDestinations
newListDestinations :: Text -> ListDestinations
newListDestinations Text
pSite_ =
ListDestinations'
{ $sel:maxResults:ListDestinations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDestinations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:state:ListDestinations' :: Maybe DestinationState
state = forall a. Maybe a
Prelude.Nothing,
$sel:site:ListDestinations' :: Text
site = Text
pSite_
}
listDestinations_maxResults :: Lens.Lens' ListDestinations (Prelude.Maybe Prelude.Natural)
listDestinations_maxResults :: Lens' ListDestinations (Maybe Natural)
listDestinations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDestinations' :: ListDestinations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDestinations
s@ListDestinations' {} Maybe Natural
a -> ListDestinations
s {$sel:maxResults:ListDestinations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDestinations)
listDestinations_nextToken :: Lens.Lens' ListDestinations (Prelude.Maybe Prelude.Text)
listDestinations_nextToken :: Lens' ListDestinations (Maybe Text)
listDestinations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDestinations' :: ListDestinations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDestinations
s@ListDestinations' {} Maybe Text
a -> ListDestinations
s {$sel:nextToken:ListDestinations' :: Maybe Text
nextToken = Maybe Text
a} :: ListDestinations)
listDestinations_state :: Lens.Lens' ListDestinations (Prelude.Maybe DestinationState)
listDestinations_state :: Lens' ListDestinations (Maybe DestinationState)
listDestinations_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinations' {Maybe DestinationState
state :: Maybe DestinationState
$sel:state:ListDestinations' :: ListDestinations -> Maybe DestinationState
state} -> Maybe DestinationState
state) (\s :: ListDestinations
s@ListDestinations' {} Maybe DestinationState
a -> ListDestinations
s {$sel:state:ListDestinations' :: Maybe DestinationState
state = Maybe DestinationState
a} :: ListDestinations)
listDestinations_site :: Lens.Lens' ListDestinations Prelude.Text
listDestinations_site :: Lens' ListDestinations Text
listDestinations_site = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinations' {Text
site :: Text
$sel:site:ListDestinations' :: ListDestinations -> Text
site} -> Text
site) (\s :: ListDestinations
s@ListDestinations' {} Text
a -> ListDestinations
s {$sel:site:ListDestinations' :: Text
site = Text
a} :: ListDestinations)
instance Core.AWSPager ListDestinations where
page :: ListDestinations
-> AWSResponse ListDestinations -> Maybe ListDestinations
page ListDestinations
rq AWSResponse ListDestinations
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDestinations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDestinationsResponse (Maybe Text)
listDestinationsResponse_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 ListDestinations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDestinationsResponse (Maybe [Destination])
listDestinationsResponse_destinations
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.$ ListDestinations
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDestinations (Maybe Text)
listDestinations_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDestinations
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDestinationsResponse (Maybe Text)
listDestinationsResponse_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 ListDestinations where
type
AWSResponse ListDestinations =
ListDestinationsResponse
request :: (Service -> Service)
-> ListDestinations -> Request ListDestinations
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 ListDestinations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDestinations)))
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 [Destination]
-> Maybe Text -> Int -> ListDestinationsResponse
ListDestinationsResponse'
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
"destinations" 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 ListDestinations where
hashWithSalt :: Int -> ListDestinations -> Int
hashWithSalt Int
_salt ListDestinations' {Maybe Natural
Maybe Text
Maybe DestinationState
Text
site :: Text
state :: Maybe DestinationState
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:site:ListDestinations' :: ListDestinations -> Text
$sel:state:ListDestinations' :: ListDestinations -> Maybe DestinationState
$sel:nextToken:ListDestinations' :: ListDestinations -> Maybe Text
$sel:maxResults:ListDestinations' :: ListDestinations -> 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` Maybe DestinationState
state
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
site
instance Prelude.NFData ListDestinations where
rnf :: ListDestinations -> ()
rnf ListDestinations' {Maybe Natural
Maybe Text
Maybe DestinationState
Text
site :: Text
state :: Maybe DestinationState
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:site:ListDestinations' :: ListDestinations -> Text
$sel:state:ListDestinations' :: ListDestinations -> Maybe DestinationState
$sel:nextToken:ListDestinations' :: ListDestinations -> Maybe Text
$sel:maxResults:ListDestinations' :: ListDestinations -> 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 Maybe DestinationState
state
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
site
instance Data.ToHeaders ListDestinations where
toHeaders :: ListDestinations -> 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 ListDestinations where
toPath :: ListDestinations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/listDestinations"
instance Data.ToQuery ListDestinations where
toQuery :: ListDestinations -> QueryString
toQuery ListDestinations' {Maybe Natural
Maybe Text
Maybe DestinationState
Text
site :: Text
state :: Maybe DestinationState
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:site:ListDestinations' :: ListDestinations -> Text
$sel:state:ListDestinations' :: ListDestinations -> Maybe DestinationState
$sel:nextToken:ListDestinations' :: ListDestinations -> Maybe Text
$sel:maxResults:ListDestinations' :: ListDestinations -> 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,
ByteString
"state" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe DestinationState
state,
ByteString
"site" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
site
]
data ListDestinationsResponse = ListDestinationsResponse'
{ ListDestinationsResponse -> Maybe [Destination]
destinations :: Prelude.Maybe [Destination],
ListDestinationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDestinationsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListDestinationsResponse -> ListDestinationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDestinationsResponse -> ListDestinationsResponse -> Bool
$c/= :: ListDestinationsResponse -> ListDestinationsResponse -> Bool
== :: ListDestinationsResponse -> ListDestinationsResponse -> Bool
$c== :: ListDestinationsResponse -> ListDestinationsResponse -> Bool
Prelude.Eq, ReadPrec [ListDestinationsResponse]
ReadPrec ListDestinationsResponse
Int -> ReadS ListDestinationsResponse
ReadS [ListDestinationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDestinationsResponse]
$creadListPrec :: ReadPrec [ListDestinationsResponse]
readPrec :: ReadPrec ListDestinationsResponse
$creadPrec :: ReadPrec ListDestinationsResponse
readList :: ReadS [ListDestinationsResponse]
$creadList :: ReadS [ListDestinationsResponse]
readsPrec :: Int -> ReadS ListDestinationsResponse
$creadsPrec :: Int -> ReadS ListDestinationsResponse
Prelude.Read, Int -> ListDestinationsResponse -> ShowS
[ListDestinationsResponse] -> ShowS
ListDestinationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDestinationsResponse] -> ShowS
$cshowList :: [ListDestinationsResponse] -> ShowS
show :: ListDestinationsResponse -> String
$cshow :: ListDestinationsResponse -> String
showsPrec :: Int -> ListDestinationsResponse -> ShowS
$cshowsPrec :: Int -> ListDestinationsResponse -> ShowS
Prelude.Show, forall x.
Rep ListDestinationsResponse x -> ListDestinationsResponse
forall x.
ListDestinationsResponse -> Rep ListDestinationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDestinationsResponse x -> ListDestinationsResponse
$cfrom :: forall x.
ListDestinationsResponse -> Rep ListDestinationsResponse x
Prelude.Generic)
newListDestinationsResponse ::
Prelude.Int ->
ListDestinationsResponse
newListDestinationsResponse :: Int -> ListDestinationsResponse
newListDestinationsResponse Int
pHttpStatus_ =
ListDestinationsResponse'
{ $sel:destinations:ListDestinationsResponse' :: Maybe [Destination]
destinations =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDestinationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDestinationsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listDestinationsResponse_destinations :: Lens.Lens' ListDestinationsResponse (Prelude.Maybe [Destination])
listDestinationsResponse_destinations :: Lens' ListDestinationsResponse (Maybe [Destination])
listDestinationsResponse_destinations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinationsResponse' {Maybe [Destination]
destinations :: Maybe [Destination]
$sel:destinations:ListDestinationsResponse' :: ListDestinationsResponse -> Maybe [Destination]
destinations} -> Maybe [Destination]
destinations) (\s :: ListDestinationsResponse
s@ListDestinationsResponse' {} Maybe [Destination]
a -> ListDestinationsResponse
s {$sel:destinations:ListDestinationsResponse' :: Maybe [Destination]
destinations = Maybe [Destination]
a} :: ListDestinationsResponse) 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
listDestinationsResponse_nextToken :: Lens.Lens' ListDestinationsResponse (Prelude.Maybe Prelude.Text)
listDestinationsResponse_nextToken :: Lens' ListDestinationsResponse (Maybe Text)
listDestinationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDestinationsResponse' :: ListDestinationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDestinationsResponse
s@ListDestinationsResponse' {} Maybe Text
a -> ListDestinationsResponse
s {$sel:nextToken:ListDestinationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDestinationsResponse)
listDestinationsResponse_httpStatus :: Lens.Lens' ListDestinationsResponse Prelude.Int
listDestinationsResponse_httpStatus :: Lens' ListDestinationsResponse Int
listDestinationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDestinationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDestinationsResponse' :: ListDestinationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDestinationsResponse
s@ListDestinationsResponse' {} Int
a -> ListDestinationsResponse
s {$sel:httpStatus:ListDestinationsResponse' :: Int
httpStatus = Int
a} :: ListDestinationsResponse)
instance Prelude.NFData ListDestinationsResponse where
rnf :: ListDestinationsResponse -> ()
rnf ListDestinationsResponse' {Int
Maybe [Destination]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
destinations :: Maybe [Destination]
$sel:httpStatus:ListDestinationsResponse' :: ListDestinationsResponse -> Int
$sel:nextToken:ListDestinationsResponse' :: ListDestinationsResponse -> Maybe Text
$sel:destinations:ListDestinationsResponse' :: ListDestinationsResponse -> Maybe [Destination]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Destination]
destinations
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