{-# 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.Pricing.GetAttributeValues
(
GetAttributeValues (..),
newGetAttributeValues,
getAttributeValues_maxResults,
getAttributeValues_nextToken,
getAttributeValues_serviceCode,
getAttributeValues_attributeName,
GetAttributeValuesResponse (..),
newGetAttributeValuesResponse,
getAttributeValuesResponse_attributeValues,
getAttributeValuesResponse_nextToken,
getAttributeValuesResponse_httpStatus,
)
where
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 Amazonka.Pricing.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetAttributeValues = GetAttributeValues'
{
GetAttributeValues -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetAttributeValues -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetAttributeValues -> Text
serviceCode :: Prelude.Text,
GetAttributeValues -> Text
attributeName :: Prelude.Text
}
deriving (GetAttributeValues -> GetAttributeValues -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttributeValues -> GetAttributeValues -> Bool
$c/= :: GetAttributeValues -> GetAttributeValues -> Bool
== :: GetAttributeValues -> GetAttributeValues -> Bool
$c== :: GetAttributeValues -> GetAttributeValues -> Bool
Prelude.Eq, ReadPrec [GetAttributeValues]
ReadPrec GetAttributeValues
Int -> ReadS GetAttributeValues
ReadS [GetAttributeValues]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttributeValues]
$creadListPrec :: ReadPrec [GetAttributeValues]
readPrec :: ReadPrec GetAttributeValues
$creadPrec :: ReadPrec GetAttributeValues
readList :: ReadS [GetAttributeValues]
$creadList :: ReadS [GetAttributeValues]
readsPrec :: Int -> ReadS GetAttributeValues
$creadsPrec :: Int -> ReadS GetAttributeValues
Prelude.Read, Int -> GetAttributeValues -> ShowS
[GetAttributeValues] -> ShowS
GetAttributeValues -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAttributeValues] -> ShowS
$cshowList :: [GetAttributeValues] -> ShowS
show :: GetAttributeValues -> String
$cshow :: GetAttributeValues -> String
showsPrec :: Int -> GetAttributeValues -> ShowS
$cshowsPrec :: Int -> GetAttributeValues -> ShowS
Prelude.Show, forall x. Rep GetAttributeValues x -> GetAttributeValues
forall x. GetAttributeValues -> Rep GetAttributeValues x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttributeValues x -> GetAttributeValues
$cfrom :: forall x. GetAttributeValues -> Rep GetAttributeValues x
Prelude.Generic)
newGetAttributeValues ::
Prelude.Text ->
Prelude.Text ->
GetAttributeValues
newGetAttributeValues :: Text -> Text -> GetAttributeValues
newGetAttributeValues Text
pServiceCode_ Text
pAttributeName_ =
GetAttributeValues'
{ $sel:maxResults:GetAttributeValues' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetAttributeValues' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:serviceCode:GetAttributeValues' :: Text
serviceCode = Text
pServiceCode_,
$sel:attributeName:GetAttributeValues' :: Text
attributeName = Text
pAttributeName_
}
getAttributeValues_maxResults :: Lens.Lens' GetAttributeValues (Prelude.Maybe Prelude.Natural)
getAttributeValues_maxResults :: Lens' GetAttributeValues (Maybe Natural)
getAttributeValues_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValues' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetAttributeValues' :: GetAttributeValues -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetAttributeValues
s@GetAttributeValues' {} Maybe Natural
a -> GetAttributeValues
s {$sel:maxResults:GetAttributeValues' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetAttributeValues)
getAttributeValues_nextToken :: Lens.Lens' GetAttributeValues (Prelude.Maybe Prelude.Text)
getAttributeValues_nextToken :: Lens' GetAttributeValues (Maybe Text)
getAttributeValues_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValues' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetAttributeValues' :: GetAttributeValues -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetAttributeValues
s@GetAttributeValues' {} Maybe Text
a -> GetAttributeValues
s {$sel:nextToken:GetAttributeValues' :: Maybe Text
nextToken = Maybe Text
a} :: GetAttributeValues)
getAttributeValues_serviceCode :: Lens.Lens' GetAttributeValues Prelude.Text
getAttributeValues_serviceCode :: Lens' GetAttributeValues Text
getAttributeValues_serviceCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValues' {Text
serviceCode :: Text
$sel:serviceCode:GetAttributeValues' :: GetAttributeValues -> Text
serviceCode} -> Text
serviceCode) (\s :: GetAttributeValues
s@GetAttributeValues' {} Text
a -> GetAttributeValues
s {$sel:serviceCode:GetAttributeValues' :: Text
serviceCode = Text
a} :: GetAttributeValues)
getAttributeValues_attributeName :: Lens.Lens' GetAttributeValues Prelude.Text
getAttributeValues_attributeName :: Lens' GetAttributeValues Text
getAttributeValues_attributeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValues' {Text
attributeName :: Text
$sel:attributeName:GetAttributeValues' :: GetAttributeValues -> Text
attributeName} -> Text
attributeName) (\s :: GetAttributeValues
s@GetAttributeValues' {} Text
a -> GetAttributeValues
s {$sel:attributeName:GetAttributeValues' :: Text
attributeName = Text
a} :: GetAttributeValues)
instance Core.AWSPager GetAttributeValues where
page :: GetAttributeValues
-> AWSResponse GetAttributeValues -> Maybe GetAttributeValues
page GetAttributeValues
rq AWSResponse GetAttributeValues
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetAttributeValues
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetAttributeValuesResponse (Maybe Text)
getAttributeValuesResponse_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 GetAttributeValues
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetAttributeValuesResponse (Maybe [AttributeValue])
getAttributeValuesResponse_attributeValues
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.$ GetAttributeValues
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetAttributeValues (Maybe Text)
getAttributeValues_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetAttributeValues
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetAttributeValuesResponse (Maybe Text)
getAttributeValuesResponse_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 GetAttributeValues where
type
AWSResponse GetAttributeValues =
GetAttributeValuesResponse
request :: (Service -> Service)
-> GetAttributeValues -> Request GetAttributeValues
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 GetAttributeValues
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetAttributeValues)))
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 [AttributeValue]
-> Maybe Text -> Int -> GetAttributeValuesResponse
GetAttributeValuesResponse'
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
"AttributeValues"
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 GetAttributeValues where
hashWithSalt :: Int -> GetAttributeValues -> Int
hashWithSalt Int
_salt GetAttributeValues' {Maybe Natural
Maybe Text
Text
attributeName :: Text
serviceCode :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:attributeName:GetAttributeValues' :: GetAttributeValues -> Text
$sel:serviceCode:GetAttributeValues' :: GetAttributeValues -> Text
$sel:nextToken:GetAttributeValues' :: GetAttributeValues -> Maybe Text
$sel:maxResults:GetAttributeValues' :: GetAttributeValues -> 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
serviceCode
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attributeName
instance Prelude.NFData GetAttributeValues where
rnf :: GetAttributeValues -> ()
rnf GetAttributeValues' {Maybe Natural
Maybe Text
Text
attributeName :: Text
serviceCode :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:attributeName:GetAttributeValues' :: GetAttributeValues -> Text
$sel:serviceCode:GetAttributeValues' :: GetAttributeValues -> Text
$sel:nextToken:GetAttributeValues' :: GetAttributeValues -> Maybe Text
$sel:maxResults:GetAttributeValues' :: GetAttributeValues -> 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
serviceCode
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
attributeName
instance Data.ToHeaders GetAttributeValues where
toHeaders :: GetAttributeValues -> 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
"AWSPriceListService.GetAttributeValues" ::
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 GetAttributeValues where
toJSON :: GetAttributeValues -> Value
toJSON GetAttributeValues' {Maybe Natural
Maybe Text
Text
attributeName :: Text
serviceCode :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:attributeName:GetAttributeValues' :: GetAttributeValues -> Text
$sel:serviceCode:GetAttributeValues' :: GetAttributeValues -> Text
$sel:nextToken:GetAttributeValues' :: GetAttributeValues -> Maybe Text
$sel:maxResults:GetAttributeValues' :: GetAttributeValues -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" 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
maxResults,
(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
"ServiceCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceCode),
forall a. a -> Maybe a
Prelude.Just
(Key
"AttributeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
attributeName)
]
)
instance Data.ToPath GetAttributeValues where
toPath :: GetAttributeValues -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetAttributeValues where
toQuery :: GetAttributeValues -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetAttributeValuesResponse = GetAttributeValuesResponse'
{
GetAttributeValuesResponse -> Maybe [AttributeValue]
attributeValues :: Prelude.Maybe [AttributeValue],
GetAttributeValuesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetAttributeValuesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetAttributeValuesResponse -> GetAttributeValuesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttributeValuesResponse -> GetAttributeValuesResponse -> Bool
$c/= :: GetAttributeValuesResponse -> GetAttributeValuesResponse -> Bool
== :: GetAttributeValuesResponse -> GetAttributeValuesResponse -> Bool
$c== :: GetAttributeValuesResponse -> GetAttributeValuesResponse -> Bool
Prelude.Eq, ReadPrec [GetAttributeValuesResponse]
ReadPrec GetAttributeValuesResponse
Int -> ReadS GetAttributeValuesResponse
ReadS [GetAttributeValuesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttributeValuesResponse]
$creadListPrec :: ReadPrec [GetAttributeValuesResponse]
readPrec :: ReadPrec GetAttributeValuesResponse
$creadPrec :: ReadPrec GetAttributeValuesResponse
readList :: ReadS [GetAttributeValuesResponse]
$creadList :: ReadS [GetAttributeValuesResponse]
readsPrec :: Int -> ReadS GetAttributeValuesResponse
$creadsPrec :: Int -> ReadS GetAttributeValuesResponse
Prelude.Read, Int -> GetAttributeValuesResponse -> ShowS
[GetAttributeValuesResponse] -> ShowS
GetAttributeValuesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAttributeValuesResponse] -> ShowS
$cshowList :: [GetAttributeValuesResponse] -> ShowS
show :: GetAttributeValuesResponse -> String
$cshow :: GetAttributeValuesResponse -> String
showsPrec :: Int -> GetAttributeValuesResponse -> ShowS
$cshowsPrec :: Int -> GetAttributeValuesResponse -> ShowS
Prelude.Show, forall x.
Rep GetAttributeValuesResponse x -> GetAttributeValuesResponse
forall x.
GetAttributeValuesResponse -> Rep GetAttributeValuesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetAttributeValuesResponse x -> GetAttributeValuesResponse
$cfrom :: forall x.
GetAttributeValuesResponse -> Rep GetAttributeValuesResponse x
Prelude.Generic)
newGetAttributeValuesResponse ::
Prelude.Int ->
GetAttributeValuesResponse
newGetAttributeValuesResponse :: Int -> GetAttributeValuesResponse
newGetAttributeValuesResponse Int
pHttpStatus_ =
GetAttributeValuesResponse'
{ $sel:attributeValues:GetAttributeValuesResponse' :: Maybe [AttributeValue]
attributeValues =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetAttributeValuesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetAttributeValuesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getAttributeValuesResponse_attributeValues :: Lens.Lens' GetAttributeValuesResponse (Prelude.Maybe [AttributeValue])
getAttributeValuesResponse_attributeValues :: Lens' GetAttributeValuesResponse (Maybe [AttributeValue])
getAttributeValuesResponse_attributeValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValuesResponse' {Maybe [AttributeValue]
attributeValues :: Maybe [AttributeValue]
$sel:attributeValues:GetAttributeValuesResponse' :: GetAttributeValuesResponse -> Maybe [AttributeValue]
attributeValues} -> Maybe [AttributeValue]
attributeValues) (\s :: GetAttributeValuesResponse
s@GetAttributeValuesResponse' {} Maybe [AttributeValue]
a -> GetAttributeValuesResponse
s {$sel:attributeValues:GetAttributeValuesResponse' :: Maybe [AttributeValue]
attributeValues = Maybe [AttributeValue]
a} :: GetAttributeValuesResponse) 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
getAttributeValuesResponse_nextToken :: Lens.Lens' GetAttributeValuesResponse (Prelude.Maybe Prelude.Text)
getAttributeValuesResponse_nextToken :: Lens' GetAttributeValuesResponse (Maybe Text)
getAttributeValuesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValuesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetAttributeValuesResponse' :: GetAttributeValuesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetAttributeValuesResponse
s@GetAttributeValuesResponse' {} Maybe Text
a -> GetAttributeValuesResponse
s {$sel:nextToken:GetAttributeValuesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetAttributeValuesResponse)
getAttributeValuesResponse_httpStatus :: Lens.Lens' GetAttributeValuesResponse Prelude.Int
getAttributeValuesResponse_httpStatus :: Lens' GetAttributeValuesResponse Int
getAttributeValuesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttributeValuesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetAttributeValuesResponse' :: GetAttributeValuesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetAttributeValuesResponse
s@GetAttributeValuesResponse' {} Int
a -> GetAttributeValuesResponse
s {$sel:httpStatus:GetAttributeValuesResponse' :: Int
httpStatus = Int
a} :: GetAttributeValuesResponse)
instance Prelude.NFData GetAttributeValuesResponse where
rnf :: GetAttributeValuesResponse -> ()
rnf GetAttributeValuesResponse' {Int
Maybe [AttributeValue]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
attributeValues :: Maybe [AttributeValue]
$sel:httpStatus:GetAttributeValuesResponse' :: GetAttributeValuesResponse -> Int
$sel:nextToken:GetAttributeValuesResponse' :: GetAttributeValuesResponse -> Maybe Text
$sel:attributeValues:GetAttributeValuesResponse' :: GetAttributeValuesResponse -> Maybe [AttributeValue]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [AttributeValue]
attributeValues
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