module Network.AWS.EC2.DescribeReservedInstancesOfferings
(
DescribeReservedInstancesOfferings
, describeReservedInstancesOfferings
, drioAvailabilityZone
, drioDryRun
, drioFilters
, drioIncludeMarketplace
, drioInstanceTenancy
, drioInstanceType
, drioMaxDuration
, drioMaxInstanceCount
, drioMaxResults
, drioMinDuration
, drioNextToken
, drioOfferingType
, drioProductDescription
, drioReservedInstancesOfferingIds
, DescribeReservedInstancesOfferingsResponse
, describeReservedInstancesOfferingsResponse
, driorNextToken
, driorReservedInstancesOfferings
) where
import Network.AWS.Prelude
import Network.AWS.Request.Query
import Network.AWS.EC2.Types
import qualified GHC.Exts
data DescribeReservedInstancesOfferings = DescribeReservedInstancesOfferings
{ _drioAvailabilityZone :: Maybe Text
, _drioDryRun :: Maybe Bool
, _drioFilters :: List "Filter" Filter
, _drioIncludeMarketplace :: Maybe Bool
, _drioInstanceTenancy :: Maybe Tenancy
, _drioInstanceType :: Maybe InstanceType
, _drioMaxDuration :: Maybe Integer
, _drioMaxInstanceCount :: Maybe Int
, _drioMaxResults :: Maybe Int
, _drioMinDuration :: Maybe Integer
, _drioNextToken :: Maybe Text
, _drioOfferingType :: Maybe OfferingTypeValues
, _drioProductDescription :: Maybe RIProductDescription
, _drioReservedInstancesOfferingIds :: List "ReservedInstancesOfferingId" Text
} deriving (Eq, Read, Show)
describeReservedInstancesOfferings :: DescribeReservedInstancesOfferings
describeReservedInstancesOfferings = DescribeReservedInstancesOfferings
{ _drioDryRun = Nothing
, _drioReservedInstancesOfferingIds = mempty
, _drioInstanceType = Nothing
, _drioAvailabilityZone = Nothing
, _drioProductDescription = Nothing
, _drioFilters = mempty
, _drioInstanceTenancy = Nothing
, _drioOfferingType = Nothing
, _drioNextToken = Nothing
, _drioMaxResults = Nothing
, _drioIncludeMarketplace = Nothing
, _drioMinDuration = Nothing
, _drioMaxDuration = Nothing
, _drioMaxInstanceCount = Nothing
}
drioAvailabilityZone :: Lens' DescribeReservedInstancesOfferings (Maybe Text)
drioAvailabilityZone =
lens _drioAvailabilityZone (\s a -> s { _drioAvailabilityZone = a })
drioDryRun :: Lens' DescribeReservedInstancesOfferings (Maybe Bool)
drioDryRun = lens _drioDryRun (\s a -> s { _drioDryRun = a })
drioFilters :: Lens' DescribeReservedInstancesOfferings [Filter]
drioFilters = lens _drioFilters (\s a -> s { _drioFilters = a }) . _List
drioIncludeMarketplace :: Lens' DescribeReservedInstancesOfferings (Maybe Bool)
drioIncludeMarketplace =
lens _drioIncludeMarketplace (\s a -> s { _drioIncludeMarketplace = a })
drioInstanceTenancy :: Lens' DescribeReservedInstancesOfferings (Maybe Tenancy)
drioInstanceTenancy =
lens _drioInstanceTenancy (\s a -> s { _drioInstanceTenancy = a })
drioInstanceType :: Lens' DescribeReservedInstancesOfferings (Maybe InstanceType)
drioInstanceType = lens _drioInstanceType (\s a -> s { _drioInstanceType = a })
drioMaxDuration :: Lens' DescribeReservedInstancesOfferings (Maybe Integer)
drioMaxDuration = lens _drioMaxDuration (\s a -> s { _drioMaxDuration = a })
drioMaxInstanceCount :: Lens' DescribeReservedInstancesOfferings (Maybe Int)
drioMaxInstanceCount =
lens _drioMaxInstanceCount (\s a -> s { _drioMaxInstanceCount = a })
drioMaxResults :: Lens' DescribeReservedInstancesOfferings (Maybe Int)
drioMaxResults = lens _drioMaxResults (\s a -> s { _drioMaxResults = a })
drioMinDuration :: Lens' DescribeReservedInstancesOfferings (Maybe Integer)
drioMinDuration = lens _drioMinDuration (\s a -> s { _drioMinDuration = a })
drioNextToken :: Lens' DescribeReservedInstancesOfferings (Maybe Text)
drioNextToken = lens _drioNextToken (\s a -> s { _drioNextToken = a })
drioOfferingType :: Lens' DescribeReservedInstancesOfferings (Maybe OfferingTypeValues)
drioOfferingType = lens _drioOfferingType (\s a -> s { _drioOfferingType = a })
drioProductDescription :: Lens' DescribeReservedInstancesOfferings (Maybe RIProductDescription)
drioProductDescription =
lens _drioProductDescription (\s a -> s { _drioProductDescription = a })
drioReservedInstancesOfferingIds :: Lens' DescribeReservedInstancesOfferings [Text]
drioReservedInstancesOfferingIds =
lens _drioReservedInstancesOfferingIds
(\s a -> s { _drioReservedInstancesOfferingIds = a })
. _List
data DescribeReservedInstancesOfferingsResponse = DescribeReservedInstancesOfferingsResponse
{ _driorNextToken :: Maybe Text
, _driorReservedInstancesOfferings :: List "item" ReservedInstancesOffering
} deriving (Eq, Read, Show)
describeReservedInstancesOfferingsResponse :: DescribeReservedInstancesOfferingsResponse
describeReservedInstancesOfferingsResponse = DescribeReservedInstancesOfferingsResponse
{ _driorReservedInstancesOfferings = mempty
, _driorNextToken = Nothing
}
driorNextToken :: Lens' DescribeReservedInstancesOfferingsResponse (Maybe Text)
driorNextToken = lens _driorNextToken (\s a -> s { _driorNextToken = a })
driorReservedInstancesOfferings :: Lens' DescribeReservedInstancesOfferingsResponse [ReservedInstancesOffering]
driorReservedInstancesOfferings =
lens _driorReservedInstancesOfferings
(\s a -> s { _driorReservedInstancesOfferings = a })
. _List
instance ToPath DescribeReservedInstancesOfferings where
toPath = const "/"
instance ToQuery DescribeReservedInstancesOfferings where
toQuery DescribeReservedInstancesOfferings{..} = mconcat
[ "AvailabilityZone" =? _drioAvailabilityZone
, "dryRun" =? _drioDryRun
, "Filter" `toQueryList` _drioFilters
, "IncludeMarketplace" =? _drioIncludeMarketplace
, "instanceTenancy" =? _drioInstanceTenancy
, "InstanceType" =? _drioInstanceType
, "MaxDuration" =? _drioMaxDuration
, "MaxInstanceCount" =? _drioMaxInstanceCount
, "maxResults" =? _drioMaxResults
, "MinDuration" =? _drioMinDuration
, "nextToken" =? _drioNextToken
, "offeringType" =? _drioOfferingType
, "ProductDescription" =? _drioProductDescription
, "ReservedInstancesOfferingId" `toQueryList` _drioReservedInstancesOfferingIds
]
instance ToHeaders DescribeReservedInstancesOfferings
instance AWSRequest DescribeReservedInstancesOfferings where
type Sv DescribeReservedInstancesOfferings = EC2
type Rs DescribeReservedInstancesOfferings = DescribeReservedInstancesOfferingsResponse
request = post "DescribeReservedInstancesOfferings"
response = xmlResponse
instance FromXML DescribeReservedInstancesOfferingsResponse where
parseXML x = DescribeReservedInstancesOfferingsResponse
<$> x .@? "nextToken"
<*> x .@? "reservedInstancesOfferingsSet" .!@ mempty
instance AWSPager DescribeReservedInstancesOfferings where
page rq rs
| stop (rq ^. drioNextToken) = Nothing
| otherwise = (\x -> rq & drioNextToken ?~ x)
<$> (rs ^. driorNextToken)