{-# 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.Config.SelectResourceConfig
(
SelectResourceConfig (..),
newSelectResourceConfig,
selectResourceConfig_limit,
selectResourceConfig_nextToken,
selectResourceConfig_expression,
SelectResourceConfigResponse (..),
newSelectResourceConfigResponse,
selectResourceConfigResponse_nextToken,
selectResourceConfigResponse_queryInfo,
selectResourceConfigResponse_results,
selectResourceConfigResponse_httpStatus,
)
where
import Amazonka.Config.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SelectResourceConfig = SelectResourceConfig'
{
SelectResourceConfig -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
SelectResourceConfig -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
SelectResourceConfig -> Text
expression :: Prelude.Text
}
deriving (SelectResourceConfig -> SelectResourceConfig -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectResourceConfig -> SelectResourceConfig -> Bool
$c/= :: SelectResourceConfig -> SelectResourceConfig -> Bool
== :: SelectResourceConfig -> SelectResourceConfig -> Bool
$c== :: SelectResourceConfig -> SelectResourceConfig -> Bool
Prelude.Eq, ReadPrec [SelectResourceConfig]
ReadPrec SelectResourceConfig
Int -> ReadS SelectResourceConfig
ReadS [SelectResourceConfig]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectResourceConfig]
$creadListPrec :: ReadPrec [SelectResourceConfig]
readPrec :: ReadPrec SelectResourceConfig
$creadPrec :: ReadPrec SelectResourceConfig
readList :: ReadS [SelectResourceConfig]
$creadList :: ReadS [SelectResourceConfig]
readsPrec :: Int -> ReadS SelectResourceConfig
$creadsPrec :: Int -> ReadS SelectResourceConfig
Prelude.Read, Int -> SelectResourceConfig -> ShowS
[SelectResourceConfig] -> ShowS
SelectResourceConfig -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectResourceConfig] -> ShowS
$cshowList :: [SelectResourceConfig] -> ShowS
show :: SelectResourceConfig -> String
$cshow :: SelectResourceConfig -> String
showsPrec :: Int -> SelectResourceConfig -> ShowS
$cshowsPrec :: Int -> SelectResourceConfig -> ShowS
Prelude.Show, forall x. Rep SelectResourceConfig x -> SelectResourceConfig
forall x. SelectResourceConfig -> Rep SelectResourceConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelectResourceConfig x -> SelectResourceConfig
$cfrom :: forall x. SelectResourceConfig -> Rep SelectResourceConfig x
Prelude.Generic)
newSelectResourceConfig ::
Prelude.Text ->
SelectResourceConfig
newSelectResourceConfig :: Text -> SelectResourceConfig
newSelectResourceConfig Text
pExpression_ =
SelectResourceConfig'
{ $sel:limit:SelectResourceConfig' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:SelectResourceConfig' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:expression:SelectResourceConfig' :: Text
expression = Text
pExpression_
}
selectResourceConfig_limit :: Lens.Lens' SelectResourceConfig (Prelude.Maybe Prelude.Natural)
selectResourceConfig_limit :: Lens' SelectResourceConfig (Maybe Natural)
selectResourceConfig_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfig' {Maybe Natural
limit :: Maybe Natural
$sel:limit:SelectResourceConfig' :: SelectResourceConfig -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: SelectResourceConfig
s@SelectResourceConfig' {} Maybe Natural
a -> SelectResourceConfig
s {$sel:limit:SelectResourceConfig' :: Maybe Natural
limit = Maybe Natural
a} :: SelectResourceConfig)
selectResourceConfig_nextToken :: Lens.Lens' SelectResourceConfig (Prelude.Maybe Prelude.Text)
selectResourceConfig_nextToken :: Lens' SelectResourceConfig (Maybe Text)
selectResourceConfig_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfig' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SelectResourceConfig' :: SelectResourceConfig -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SelectResourceConfig
s@SelectResourceConfig' {} Maybe Text
a -> SelectResourceConfig
s {$sel:nextToken:SelectResourceConfig' :: Maybe Text
nextToken = Maybe Text
a} :: SelectResourceConfig)
selectResourceConfig_expression :: Lens.Lens' SelectResourceConfig Prelude.Text
selectResourceConfig_expression :: Lens' SelectResourceConfig Text
selectResourceConfig_expression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfig' {Text
expression :: Text
$sel:expression:SelectResourceConfig' :: SelectResourceConfig -> Text
expression} -> Text
expression) (\s :: SelectResourceConfig
s@SelectResourceConfig' {} Text
a -> SelectResourceConfig
s {$sel:expression:SelectResourceConfig' :: Text
expression = Text
a} :: SelectResourceConfig)
instance Core.AWSPager SelectResourceConfig where
page :: SelectResourceConfig
-> AWSResponse SelectResourceConfig -> Maybe SelectResourceConfig
page SelectResourceConfig
rq AWSResponse SelectResourceConfig
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse SelectResourceConfig
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SelectResourceConfigResponse (Maybe Text)
selectResourceConfigResponse_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 SelectResourceConfig
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SelectResourceConfigResponse (Maybe [Text])
selectResourceConfigResponse_results
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.$ SelectResourceConfig
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' SelectResourceConfig (Maybe Text)
selectResourceConfig_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse SelectResourceConfig
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' SelectResourceConfigResponse (Maybe Text)
selectResourceConfigResponse_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 SelectResourceConfig where
type
AWSResponse SelectResourceConfig =
SelectResourceConfigResponse
request :: (Service -> Service)
-> SelectResourceConfig -> Request SelectResourceConfig
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy SelectResourceConfig
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse SelectResourceConfig)))
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 Text
-> Maybe QueryInfo
-> Maybe [Text]
-> Int
-> SelectResourceConfigResponse
SelectResourceConfigResponse'
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
"NextToken")
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
"QueryInfo")
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
"Results" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable SelectResourceConfig where
hashWithSalt :: Int -> SelectResourceConfig -> Int
hashWithSalt Int
_salt SelectResourceConfig' {Maybe Natural
Maybe Text
Text
expression :: Text
nextToken :: Maybe Text
limit :: Maybe Natural
$sel:expression:SelectResourceConfig' :: SelectResourceConfig -> Text
$sel:nextToken:SelectResourceConfig' :: SelectResourceConfig -> Maybe Text
$sel:limit:SelectResourceConfig' :: SelectResourceConfig -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
expression
instance Prelude.NFData SelectResourceConfig where
rnf :: SelectResourceConfig -> ()
rnf SelectResourceConfig' {Maybe Natural
Maybe Text
Text
expression :: Text
nextToken :: Maybe Text
limit :: Maybe Natural
$sel:expression:SelectResourceConfig' :: SelectResourceConfig -> Text
$sel:nextToken:SelectResourceConfig' :: SelectResourceConfig -> Maybe Text
$sel:limit:SelectResourceConfig' :: SelectResourceConfig -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
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
expression
instance Data.ToHeaders SelectResourceConfig where
toHeaders :: SelectResourceConfig -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"StarlingDoveService.SelectResourceConfig" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON SelectResourceConfig where
toJSON :: SelectResourceConfig -> Value
toJSON SelectResourceConfig' {Maybe Natural
Maybe Text
Text
expression :: Text
nextToken :: Maybe Text
limit :: Maybe Natural
$sel:expression:SelectResourceConfig' :: SelectResourceConfig -> Text
$sel:nextToken:SelectResourceConfig' :: SelectResourceConfig -> Maybe Text
$sel:limit:SelectResourceConfig' :: SelectResourceConfig -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Limit" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
forall a. a -> Maybe a
Prelude.Just (Key
"Expression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
expression)
]
)
instance Data.ToPath SelectResourceConfig where
toPath :: SelectResourceConfig -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery SelectResourceConfig where
toQuery :: SelectResourceConfig -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data SelectResourceConfigResponse = SelectResourceConfigResponse'
{
SelectResourceConfigResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
SelectResourceConfigResponse -> Maybe QueryInfo
queryInfo :: Prelude.Maybe QueryInfo,
SelectResourceConfigResponse -> Maybe [Text]
results :: Prelude.Maybe [Prelude.Text],
SelectResourceConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SelectResourceConfigResponse
-> SelectResourceConfigResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectResourceConfigResponse
-> SelectResourceConfigResponse -> Bool
$c/= :: SelectResourceConfigResponse
-> SelectResourceConfigResponse -> Bool
== :: SelectResourceConfigResponse
-> SelectResourceConfigResponse -> Bool
$c== :: SelectResourceConfigResponse
-> SelectResourceConfigResponse -> Bool
Prelude.Eq, ReadPrec [SelectResourceConfigResponse]
ReadPrec SelectResourceConfigResponse
Int -> ReadS SelectResourceConfigResponse
ReadS [SelectResourceConfigResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SelectResourceConfigResponse]
$creadListPrec :: ReadPrec [SelectResourceConfigResponse]
readPrec :: ReadPrec SelectResourceConfigResponse
$creadPrec :: ReadPrec SelectResourceConfigResponse
readList :: ReadS [SelectResourceConfigResponse]
$creadList :: ReadS [SelectResourceConfigResponse]
readsPrec :: Int -> ReadS SelectResourceConfigResponse
$creadsPrec :: Int -> ReadS SelectResourceConfigResponse
Prelude.Read, Int -> SelectResourceConfigResponse -> ShowS
[SelectResourceConfigResponse] -> ShowS
SelectResourceConfigResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectResourceConfigResponse] -> ShowS
$cshowList :: [SelectResourceConfigResponse] -> ShowS
show :: SelectResourceConfigResponse -> String
$cshow :: SelectResourceConfigResponse -> String
showsPrec :: Int -> SelectResourceConfigResponse -> ShowS
$cshowsPrec :: Int -> SelectResourceConfigResponse -> ShowS
Prelude.Show, forall x.
Rep SelectResourceConfigResponse x -> SelectResourceConfigResponse
forall x.
SelectResourceConfigResponse -> Rep SelectResourceConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SelectResourceConfigResponse x -> SelectResourceConfigResponse
$cfrom :: forall x.
SelectResourceConfigResponse -> Rep SelectResourceConfigResponse x
Prelude.Generic)
newSelectResourceConfigResponse ::
Prelude.Int ->
SelectResourceConfigResponse
newSelectResourceConfigResponse :: Int -> SelectResourceConfigResponse
newSelectResourceConfigResponse Int
pHttpStatus_ =
SelectResourceConfigResponse'
{ $sel:nextToken:SelectResourceConfigResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:queryInfo:SelectResourceConfigResponse' :: Maybe QueryInfo
queryInfo = forall a. Maybe a
Prelude.Nothing,
$sel:results:SelectResourceConfigResponse' :: Maybe [Text]
results = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SelectResourceConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
selectResourceConfigResponse_nextToken :: Lens.Lens' SelectResourceConfigResponse (Prelude.Maybe Prelude.Text)
selectResourceConfigResponse_nextToken :: Lens' SelectResourceConfigResponse (Maybe Text)
selectResourceConfigResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfigResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SelectResourceConfigResponse
s@SelectResourceConfigResponse' {} Maybe Text
a -> SelectResourceConfigResponse
s {$sel:nextToken:SelectResourceConfigResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SelectResourceConfigResponse)
selectResourceConfigResponse_queryInfo :: Lens.Lens' SelectResourceConfigResponse (Prelude.Maybe QueryInfo)
selectResourceConfigResponse_queryInfo :: Lens' SelectResourceConfigResponse (Maybe QueryInfo)
selectResourceConfigResponse_queryInfo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfigResponse' {Maybe QueryInfo
queryInfo :: Maybe QueryInfo
$sel:queryInfo:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Maybe QueryInfo
queryInfo} -> Maybe QueryInfo
queryInfo) (\s :: SelectResourceConfigResponse
s@SelectResourceConfigResponse' {} Maybe QueryInfo
a -> SelectResourceConfigResponse
s {$sel:queryInfo:SelectResourceConfigResponse' :: Maybe QueryInfo
queryInfo = Maybe QueryInfo
a} :: SelectResourceConfigResponse)
selectResourceConfigResponse_results :: Lens.Lens' SelectResourceConfigResponse (Prelude.Maybe [Prelude.Text])
selectResourceConfigResponse_results :: Lens' SelectResourceConfigResponse (Maybe [Text])
selectResourceConfigResponse_results = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfigResponse' {Maybe [Text]
results :: Maybe [Text]
$sel:results:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Maybe [Text]
results} -> Maybe [Text]
results) (\s :: SelectResourceConfigResponse
s@SelectResourceConfigResponse' {} Maybe [Text]
a -> SelectResourceConfigResponse
s {$sel:results:SelectResourceConfigResponse' :: Maybe [Text]
results = Maybe [Text]
a} :: SelectResourceConfigResponse) 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
selectResourceConfigResponse_httpStatus :: Lens.Lens' SelectResourceConfigResponse Prelude.Int
selectResourceConfigResponse_httpStatus :: Lens' SelectResourceConfigResponse Int
selectResourceConfigResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SelectResourceConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SelectResourceConfigResponse
s@SelectResourceConfigResponse' {} Int
a -> SelectResourceConfigResponse
s {$sel:httpStatus:SelectResourceConfigResponse' :: Int
httpStatus = Int
a} :: SelectResourceConfigResponse)
instance Prelude.NFData SelectResourceConfigResponse where
rnf :: SelectResourceConfigResponse -> ()
rnf SelectResourceConfigResponse' {Int
Maybe [Text]
Maybe Text
Maybe QueryInfo
httpStatus :: Int
results :: Maybe [Text]
queryInfo :: Maybe QueryInfo
nextToken :: Maybe Text
$sel:httpStatus:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Int
$sel:results:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Maybe [Text]
$sel:queryInfo:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Maybe QueryInfo
$sel:nextToken:SelectResourceConfigResponse' :: SelectResourceConfigResponse -> Maybe Text
..} =
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 QueryInfo
queryInfo
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
results
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus