{-# 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.EMR.AddInstanceFleet
(
AddInstanceFleet (..),
newAddInstanceFleet,
addInstanceFleet_clusterId,
addInstanceFleet_instanceFleet,
AddInstanceFleetResponse (..),
newAddInstanceFleetResponse,
addInstanceFleetResponse_clusterArn,
addInstanceFleetResponse_clusterId,
addInstanceFleetResponse_instanceFleetId,
addInstanceFleetResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EMR.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddInstanceFleet = AddInstanceFleet'
{
AddInstanceFleet -> Text
clusterId :: Prelude.Text,
AddInstanceFleet -> InstanceFleetConfig
instanceFleet :: InstanceFleetConfig
}
deriving (AddInstanceFleet -> AddInstanceFleet -> Bool
(AddInstanceFleet -> AddInstanceFleet -> Bool)
-> (AddInstanceFleet -> AddInstanceFleet -> Bool)
-> Eq AddInstanceFleet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddInstanceFleet -> AddInstanceFleet -> Bool
$c/= :: AddInstanceFleet -> AddInstanceFleet -> Bool
== :: AddInstanceFleet -> AddInstanceFleet -> Bool
$c== :: AddInstanceFleet -> AddInstanceFleet -> Bool
Prelude.Eq, ReadPrec [AddInstanceFleet]
ReadPrec AddInstanceFleet
Int -> ReadS AddInstanceFleet
ReadS [AddInstanceFleet]
(Int -> ReadS AddInstanceFleet)
-> ReadS [AddInstanceFleet]
-> ReadPrec AddInstanceFleet
-> ReadPrec [AddInstanceFleet]
-> Read AddInstanceFleet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddInstanceFleet]
$creadListPrec :: ReadPrec [AddInstanceFleet]
readPrec :: ReadPrec AddInstanceFleet
$creadPrec :: ReadPrec AddInstanceFleet
readList :: ReadS [AddInstanceFleet]
$creadList :: ReadS [AddInstanceFleet]
readsPrec :: Int -> ReadS AddInstanceFleet
$creadsPrec :: Int -> ReadS AddInstanceFleet
Prelude.Read, Int -> AddInstanceFleet -> ShowS
[AddInstanceFleet] -> ShowS
AddInstanceFleet -> String
(Int -> AddInstanceFleet -> ShowS)
-> (AddInstanceFleet -> String)
-> ([AddInstanceFleet] -> ShowS)
-> Show AddInstanceFleet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddInstanceFleet] -> ShowS
$cshowList :: [AddInstanceFleet] -> ShowS
show :: AddInstanceFleet -> String
$cshow :: AddInstanceFleet -> String
showsPrec :: Int -> AddInstanceFleet -> ShowS
$cshowsPrec :: Int -> AddInstanceFleet -> ShowS
Prelude.Show, (forall x. AddInstanceFleet -> Rep AddInstanceFleet x)
-> (forall x. Rep AddInstanceFleet x -> AddInstanceFleet)
-> Generic AddInstanceFleet
forall x. Rep AddInstanceFleet x -> AddInstanceFleet
forall x. AddInstanceFleet -> Rep AddInstanceFleet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddInstanceFleet x -> AddInstanceFleet
$cfrom :: forall x. AddInstanceFleet -> Rep AddInstanceFleet x
Prelude.Generic)
newAddInstanceFleet ::
Prelude.Text ->
InstanceFleetConfig ->
AddInstanceFleet
newAddInstanceFleet :: Text -> InstanceFleetConfig -> AddInstanceFleet
newAddInstanceFleet Text
pClusterId_ InstanceFleetConfig
pInstanceFleet_ =
AddInstanceFleet' :: Text -> InstanceFleetConfig -> AddInstanceFleet
AddInstanceFleet'
{ $sel:clusterId:AddInstanceFleet' :: Text
clusterId = Text
pClusterId_,
$sel:instanceFleet:AddInstanceFleet' :: InstanceFleetConfig
instanceFleet = InstanceFleetConfig
pInstanceFleet_
}
addInstanceFleet_clusterId :: Lens.Lens' AddInstanceFleet Prelude.Text
addInstanceFleet_clusterId :: (Text -> f Text) -> AddInstanceFleet -> f AddInstanceFleet
addInstanceFleet_clusterId = (AddInstanceFleet -> Text)
-> (AddInstanceFleet -> Text -> AddInstanceFleet)
-> Lens AddInstanceFleet AddInstanceFleet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddInstanceFleet' {Text
clusterId :: Text
$sel:clusterId:AddInstanceFleet' :: AddInstanceFleet -> Text
clusterId} -> Text
clusterId) (\s :: AddInstanceFleet
s@AddInstanceFleet' {} Text
a -> AddInstanceFleet
s {$sel:clusterId:AddInstanceFleet' :: Text
clusterId = Text
a} :: AddInstanceFleet)
addInstanceFleet_instanceFleet :: Lens.Lens' AddInstanceFleet InstanceFleetConfig
addInstanceFleet_instanceFleet :: (InstanceFleetConfig -> f InstanceFleetConfig)
-> AddInstanceFleet -> f AddInstanceFleet
addInstanceFleet_instanceFleet = (AddInstanceFleet -> InstanceFleetConfig)
-> (AddInstanceFleet -> InstanceFleetConfig -> AddInstanceFleet)
-> Lens
AddInstanceFleet
AddInstanceFleet
InstanceFleetConfig
InstanceFleetConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddInstanceFleet' {InstanceFleetConfig
instanceFleet :: InstanceFleetConfig
$sel:instanceFleet:AddInstanceFleet' :: AddInstanceFleet -> InstanceFleetConfig
instanceFleet} -> InstanceFleetConfig
instanceFleet) (\s :: AddInstanceFleet
s@AddInstanceFleet' {} InstanceFleetConfig
a -> AddInstanceFleet
s {$sel:instanceFleet:AddInstanceFleet' :: InstanceFleetConfig
instanceFleet = InstanceFleetConfig
a} :: AddInstanceFleet)
instance Core.AWSRequest AddInstanceFleet where
type
AWSResponse AddInstanceFleet =
AddInstanceFleetResponse
request :: AddInstanceFleet -> Request AddInstanceFleet
request = Service -> AddInstanceFleet -> Request AddInstanceFleet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddInstanceFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddInstanceFleet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddInstanceFleet))
-> Logger
-> Service
-> Proxy AddInstanceFleet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AddInstanceFleet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Int -> AddInstanceFleetResponse
AddInstanceFleetResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> AddInstanceFleetResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text -> Maybe Text -> Int -> AddInstanceFleetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ClusterArn")
Either
String
(Maybe Text -> Maybe Text -> Int -> AddInstanceFleetResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> AddInstanceFleetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ClusterId")
Either String (Maybe Text -> Int -> AddInstanceFleetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AddInstanceFleetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"InstanceFleetId")
Either String (Int -> AddInstanceFleetResponse)
-> Either String Int -> Either String AddInstanceFleetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable AddInstanceFleet
instance Prelude.NFData AddInstanceFleet
instance Core.ToHeaders AddInstanceFleet where
toHeaders :: AddInstanceFleet -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddInstanceFleet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"ElasticMapReduce.AddInstanceFleet" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AddInstanceFleet where
toJSON :: AddInstanceFleet -> Value
toJSON AddInstanceFleet' {Text
InstanceFleetConfig
instanceFleet :: InstanceFleetConfig
clusterId :: Text
$sel:instanceFleet:AddInstanceFleet' :: AddInstanceFleet -> InstanceFleetConfig
$sel:clusterId:AddInstanceFleet' :: AddInstanceFleet -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClusterId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clusterId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"InstanceFleet" Text -> InstanceFleetConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InstanceFleetConfig
instanceFleet)
]
)
instance Core.ToPath AddInstanceFleet where
toPath :: AddInstanceFleet -> ByteString
toPath = ByteString -> AddInstanceFleet -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddInstanceFleet where
toQuery :: AddInstanceFleet -> QueryString
toQuery = QueryString -> AddInstanceFleet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddInstanceFleetResponse = AddInstanceFleetResponse'
{
AddInstanceFleetResponse -> Maybe Text
clusterArn :: Prelude.Maybe Prelude.Text,
AddInstanceFleetResponse -> Maybe Text
clusterId :: Prelude.Maybe Prelude.Text,
AddInstanceFleetResponse -> Maybe Text
instanceFleetId :: Prelude.Maybe Prelude.Text,
AddInstanceFleetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool
(AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool)
-> (AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool)
-> Eq AddInstanceFleetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool
$c/= :: AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool
== :: AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool
$c== :: AddInstanceFleetResponse -> AddInstanceFleetResponse -> Bool
Prelude.Eq, ReadPrec [AddInstanceFleetResponse]
ReadPrec AddInstanceFleetResponse
Int -> ReadS AddInstanceFleetResponse
ReadS [AddInstanceFleetResponse]
(Int -> ReadS AddInstanceFleetResponse)
-> ReadS [AddInstanceFleetResponse]
-> ReadPrec AddInstanceFleetResponse
-> ReadPrec [AddInstanceFleetResponse]
-> Read AddInstanceFleetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddInstanceFleetResponse]
$creadListPrec :: ReadPrec [AddInstanceFleetResponse]
readPrec :: ReadPrec AddInstanceFleetResponse
$creadPrec :: ReadPrec AddInstanceFleetResponse
readList :: ReadS [AddInstanceFleetResponse]
$creadList :: ReadS [AddInstanceFleetResponse]
readsPrec :: Int -> ReadS AddInstanceFleetResponse
$creadsPrec :: Int -> ReadS AddInstanceFleetResponse
Prelude.Read, Int -> AddInstanceFleetResponse -> ShowS
[AddInstanceFleetResponse] -> ShowS
AddInstanceFleetResponse -> String
(Int -> AddInstanceFleetResponse -> ShowS)
-> (AddInstanceFleetResponse -> String)
-> ([AddInstanceFleetResponse] -> ShowS)
-> Show AddInstanceFleetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddInstanceFleetResponse] -> ShowS
$cshowList :: [AddInstanceFleetResponse] -> ShowS
show :: AddInstanceFleetResponse -> String
$cshow :: AddInstanceFleetResponse -> String
showsPrec :: Int -> AddInstanceFleetResponse -> ShowS
$cshowsPrec :: Int -> AddInstanceFleetResponse -> ShowS
Prelude.Show, (forall x.
AddInstanceFleetResponse -> Rep AddInstanceFleetResponse x)
-> (forall x.
Rep AddInstanceFleetResponse x -> AddInstanceFleetResponse)
-> Generic AddInstanceFleetResponse
forall x.
Rep AddInstanceFleetResponse x -> AddInstanceFleetResponse
forall x.
AddInstanceFleetResponse -> Rep AddInstanceFleetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddInstanceFleetResponse x -> AddInstanceFleetResponse
$cfrom :: forall x.
AddInstanceFleetResponse -> Rep AddInstanceFleetResponse x
Prelude.Generic)
newAddInstanceFleetResponse ::
Prelude.Int ->
AddInstanceFleetResponse
newAddInstanceFleetResponse :: Int -> AddInstanceFleetResponse
newAddInstanceFleetResponse Int
pHttpStatus_ =
AddInstanceFleetResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> AddInstanceFleetResponse
AddInstanceFleetResponse'
{ $sel:clusterArn:AddInstanceFleetResponse' :: Maybe Text
clusterArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:clusterId:AddInstanceFleetResponse' :: Maybe Text
clusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:instanceFleetId:AddInstanceFleetResponse' :: Maybe Text
instanceFleetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AddInstanceFleetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
addInstanceFleetResponse_clusterArn :: Lens.Lens' AddInstanceFleetResponse (Prelude.Maybe Prelude.Text)
addInstanceFleetResponse_clusterArn :: (Maybe Text -> f (Maybe Text))
-> AddInstanceFleetResponse -> f AddInstanceFleetResponse
addInstanceFleetResponse_clusterArn = (AddInstanceFleetResponse -> Maybe Text)
-> (AddInstanceFleetResponse
-> Maybe Text -> AddInstanceFleetResponse)
-> Lens
AddInstanceFleetResponse
AddInstanceFleetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddInstanceFleetResponse' {Maybe Text
clusterArn :: Maybe Text
$sel:clusterArn:AddInstanceFleetResponse' :: AddInstanceFleetResponse -> Maybe Text
clusterArn} -> Maybe Text
clusterArn) (\s :: AddInstanceFleetResponse
s@AddInstanceFleetResponse' {} Maybe Text
a -> AddInstanceFleetResponse
s {$sel:clusterArn:AddInstanceFleetResponse' :: Maybe Text
clusterArn = Maybe Text
a} :: AddInstanceFleetResponse)
addInstanceFleetResponse_clusterId :: Lens.Lens' AddInstanceFleetResponse (Prelude.Maybe Prelude.Text)
addInstanceFleetResponse_clusterId :: (Maybe Text -> f (Maybe Text))
-> AddInstanceFleetResponse -> f AddInstanceFleetResponse
addInstanceFleetResponse_clusterId = (AddInstanceFleetResponse -> Maybe Text)
-> (AddInstanceFleetResponse
-> Maybe Text -> AddInstanceFleetResponse)
-> Lens
AddInstanceFleetResponse
AddInstanceFleetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddInstanceFleetResponse' {Maybe Text
clusterId :: Maybe Text
$sel:clusterId:AddInstanceFleetResponse' :: AddInstanceFleetResponse -> Maybe Text
clusterId} -> Maybe Text
clusterId) (\s :: AddInstanceFleetResponse
s@AddInstanceFleetResponse' {} Maybe Text
a -> AddInstanceFleetResponse
s {$sel:clusterId:AddInstanceFleetResponse' :: Maybe Text
clusterId = Maybe Text
a} :: AddInstanceFleetResponse)
addInstanceFleetResponse_instanceFleetId :: Lens.Lens' AddInstanceFleetResponse (Prelude.Maybe Prelude.Text)
addInstanceFleetResponse_instanceFleetId :: (Maybe Text -> f (Maybe Text))
-> AddInstanceFleetResponse -> f AddInstanceFleetResponse
addInstanceFleetResponse_instanceFleetId = (AddInstanceFleetResponse -> Maybe Text)
-> (AddInstanceFleetResponse
-> Maybe Text -> AddInstanceFleetResponse)
-> Lens
AddInstanceFleetResponse
AddInstanceFleetResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddInstanceFleetResponse' {Maybe Text
instanceFleetId :: Maybe Text
$sel:instanceFleetId:AddInstanceFleetResponse' :: AddInstanceFleetResponse -> Maybe Text
instanceFleetId} -> Maybe Text
instanceFleetId) (\s :: AddInstanceFleetResponse
s@AddInstanceFleetResponse' {} Maybe Text
a -> AddInstanceFleetResponse
s {$sel:instanceFleetId:AddInstanceFleetResponse' :: Maybe Text
instanceFleetId = Maybe Text
a} :: AddInstanceFleetResponse)
addInstanceFleetResponse_httpStatus :: Lens.Lens' AddInstanceFleetResponse Prelude.Int
addInstanceFleetResponse_httpStatus :: (Int -> f Int)
-> AddInstanceFleetResponse -> f AddInstanceFleetResponse
addInstanceFleetResponse_httpStatus = (AddInstanceFleetResponse -> Int)
-> (AddInstanceFleetResponse -> Int -> AddInstanceFleetResponse)
-> Lens AddInstanceFleetResponse AddInstanceFleetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddInstanceFleetResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddInstanceFleetResponse' :: AddInstanceFleetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddInstanceFleetResponse
s@AddInstanceFleetResponse' {} Int
a -> AddInstanceFleetResponse
s {$sel:httpStatus:AddInstanceFleetResponse' :: Int
httpStatus = Int
a} :: AddInstanceFleetResponse)
instance Prelude.NFData AddInstanceFleetResponse