packages feed

stratosphere-0.4.1: library-gen/Stratosphere/ResourceProperties/EMRClusterPlacementType.hs

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-placementtype.html

module Stratosphere.ResourceProperties.EMRClusterPlacementType where

import Control.Lens hiding ((.=))
import Data.Aeson
import Data.Maybe (catMaybes)
import Data.Monoid (mempty)
import Data.Text

import Stratosphere.Values


-- | Full data type definition for EMRClusterPlacementType. See
-- | 'emrClusterPlacementType' for a more convenient constructor.
data EMRClusterPlacementType =
  EMRClusterPlacementType
  { _eMRClusterPlacementTypeAvailabilityZone :: Val Text
  } deriving (Show, Eq)

instance ToJSON EMRClusterPlacementType where
  toJSON EMRClusterPlacementType{..} =
    object $
    catMaybes
    [ Just ("AvailabilityZone" .= _eMRClusterPlacementTypeAvailabilityZone)
    ]

instance FromJSON EMRClusterPlacementType where
  parseJSON (Object obj) =
    EMRClusterPlacementType <$>
      obj .: "AvailabilityZone"
  parseJSON _ = mempty

-- | Constructor for 'EMRClusterPlacementType' containing required fields as
-- | arguments.
emrClusterPlacementType
  :: Val Text -- ^ 'emrcptAvailabilityZone'
  -> EMRClusterPlacementType
emrClusterPlacementType availabilityZonearg =
  EMRClusterPlacementType
  { _eMRClusterPlacementTypeAvailabilityZone = availabilityZonearg
  }

-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-emr-cluster-jobflowinstancesconfig-placementtype.html#aws-properties-emr-cluster-jobflowinstancesconfig-placementtype
emrcptAvailabilityZone :: Lens' EMRClusterPlacementType (Val Text)
emrcptAvailabilityZone = lens _eMRClusterPlacementTypeAvailabilityZone (\s a -> s { _eMRClusterPlacementTypeAvailabilityZone = a })