{-# 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.OpsWorks.AssignInstance
(
AssignInstance (..),
newAssignInstance,
assignInstance_instanceId,
assignInstance_layerIds,
AssignInstanceResponse (..),
newAssignInstanceResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssignInstance = AssignInstance'
{
AssignInstance -> Text
instanceId :: Prelude.Text,
AssignInstance -> [Text]
layerIds :: [Prelude.Text]
}
deriving (AssignInstance -> AssignInstance -> Bool
(AssignInstance -> AssignInstance -> Bool)
-> (AssignInstance -> AssignInstance -> Bool) -> Eq AssignInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssignInstance -> AssignInstance -> Bool
$c/= :: AssignInstance -> AssignInstance -> Bool
== :: AssignInstance -> AssignInstance -> Bool
$c== :: AssignInstance -> AssignInstance -> Bool
Prelude.Eq, ReadPrec [AssignInstance]
ReadPrec AssignInstance
Int -> ReadS AssignInstance
ReadS [AssignInstance]
(Int -> ReadS AssignInstance)
-> ReadS [AssignInstance]
-> ReadPrec AssignInstance
-> ReadPrec [AssignInstance]
-> Read AssignInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssignInstance]
$creadListPrec :: ReadPrec [AssignInstance]
readPrec :: ReadPrec AssignInstance
$creadPrec :: ReadPrec AssignInstance
readList :: ReadS [AssignInstance]
$creadList :: ReadS [AssignInstance]
readsPrec :: Int -> ReadS AssignInstance
$creadsPrec :: Int -> ReadS AssignInstance
Prelude.Read, Int -> AssignInstance -> ShowS
[AssignInstance] -> ShowS
AssignInstance -> String
(Int -> AssignInstance -> ShowS)
-> (AssignInstance -> String)
-> ([AssignInstance] -> ShowS)
-> Show AssignInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssignInstance] -> ShowS
$cshowList :: [AssignInstance] -> ShowS
show :: AssignInstance -> String
$cshow :: AssignInstance -> String
showsPrec :: Int -> AssignInstance -> ShowS
$cshowsPrec :: Int -> AssignInstance -> ShowS
Prelude.Show, (forall x. AssignInstance -> Rep AssignInstance x)
-> (forall x. Rep AssignInstance x -> AssignInstance)
-> Generic AssignInstance
forall x. Rep AssignInstance x -> AssignInstance
forall x. AssignInstance -> Rep AssignInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssignInstance x -> AssignInstance
$cfrom :: forall x. AssignInstance -> Rep AssignInstance x
Prelude.Generic)
newAssignInstance ::
Prelude.Text ->
AssignInstance
newAssignInstance :: Text -> AssignInstance
newAssignInstance Text
pInstanceId_ =
AssignInstance' :: Text -> [Text] -> AssignInstance
AssignInstance'
{ $sel:instanceId:AssignInstance' :: Text
instanceId = Text
pInstanceId_,
$sel:layerIds:AssignInstance' :: [Text]
layerIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
assignInstance_instanceId :: Lens.Lens' AssignInstance Prelude.Text
assignInstance_instanceId :: (Text -> f Text) -> AssignInstance -> f AssignInstance
assignInstance_instanceId = (AssignInstance -> Text)
-> (AssignInstance -> Text -> AssignInstance)
-> Lens AssignInstance AssignInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssignInstance' {Text
instanceId :: Text
$sel:instanceId:AssignInstance' :: AssignInstance -> Text
instanceId} -> Text
instanceId) (\s :: AssignInstance
s@AssignInstance' {} Text
a -> AssignInstance
s {$sel:instanceId:AssignInstance' :: Text
instanceId = Text
a} :: AssignInstance)
assignInstance_layerIds :: Lens.Lens' AssignInstance [Prelude.Text]
assignInstance_layerIds :: ([Text] -> f [Text]) -> AssignInstance -> f AssignInstance
assignInstance_layerIds = (AssignInstance -> [Text])
-> (AssignInstance -> [Text] -> AssignInstance)
-> Lens AssignInstance AssignInstance [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssignInstance' {[Text]
layerIds :: [Text]
$sel:layerIds:AssignInstance' :: AssignInstance -> [Text]
layerIds} -> [Text]
layerIds) (\s :: AssignInstance
s@AssignInstance' {} [Text]
a -> AssignInstance
s {$sel:layerIds:AssignInstance' :: [Text]
layerIds = [Text]
a} :: AssignInstance) (([Text] -> f [Text]) -> AssignInstance -> f AssignInstance)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AssignInstance
-> f AssignInstance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AssignInstance where
type
AWSResponse AssignInstance =
AssignInstanceResponse
request :: AssignInstance -> Request AssignInstance
request = Service -> AssignInstance -> Request AssignInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssignInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssignInstance)))
response =
AWSResponse AssignInstance
-> Logger
-> Service
-> Proxy AssignInstance
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssignInstance)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse AssignInstance
AssignInstanceResponse
AssignInstanceResponse'
instance Prelude.Hashable AssignInstance
instance Prelude.NFData AssignInstance
instance Core.ToHeaders AssignInstance where
toHeaders :: AssignInstance -> [Header]
toHeaders =
[Header] -> AssignInstance -> [Header]
forall a b. a -> b -> a
Prelude.const
( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"OpsWorks_20130218.AssignInstance" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON AssignInstance where
toJSON :: AssignInstance -> Value
toJSON AssignInstance' {[Text]
Text
layerIds :: [Text]
instanceId :: Text
$sel:layerIds:AssignInstance' :: AssignInstance -> [Text]
$sel:instanceId:AssignInstance' :: AssignInstance -> 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
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LayerIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
layerIds)
]
)
instance Core.ToPath AssignInstance where
toPath :: AssignInstance -> ByteString
toPath = ByteString -> AssignInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssignInstance where
toQuery :: AssignInstance -> QueryString
toQuery = QueryString -> AssignInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssignInstanceResponse = AssignInstanceResponse'
{
}
deriving (AssignInstanceResponse -> AssignInstanceResponse -> Bool
(AssignInstanceResponse -> AssignInstanceResponse -> Bool)
-> (AssignInstanceResponse -> AssignInstanceResponse -> Bool)
-> Eq AssignInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssignInstanceResponse -> AssignInstanceResponse -> Bool
$c/= :: AssignInstanceResponse -> AssignInstanceResponse -> Bool
== :: AssignInstanceResponse -> AssignInstanceResponse -> Bool
$c== :: AssignInstanceResponse -> AssignInstanceResponse -> Bool
Prelude.Eq, ReadPrec [AssignInstanceResponse]
ReadPrec AssignInstanceResponse
Int -> ReadS AssignInstanceResponse
ReadS [AssignInstanceResponse]
(Int -> ReadS AssignInstanceResponse)
-> ReadS [AssignInstanceResponse]
-> ReadPrec AssignInstanceResponse
-> ReadPrec [AssignInstanceResponse]
-> Read AssignInstanceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssignInstanceResponse]
$creadListPrec :: ReadPrec [AssignInstanceResponse]
readPrec :: ReadPrec AssignInstanceResponse
$creadPrec :: ReadPrec AssignInstanceResponse
readList :: ReadS [AssignInstanceResponse]
$creadList :: ReadS [AssignInstanceResponse]
readsPrec :: Int -> ReadS AssignInstanceResponse
$creadsPrec :: Int -> ReadS AssignInstanceResponse
Prelude.Read, Int -> AssignInstanceResponse -> ShowS
[AssignInstanceResponse] -> ShowS
AssignInstanceResponse -> String
(Int -> AssignInstanceResponse -> ShowS)
-> (AssignInstanceResponse -> String)
-> ([AssignInstanceResponse] -> ShowS)
-> Show AssignInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssignInstanceResponse] -> ShowS
$cshowList :: [AssignInstanceResponse] -> ShowS
show :: AssignInstanceResponse -> String
$cshow :: AssignInstanceResponse -> String
showsPrec :: Int -> AssignInstanceResponse -> ShowS
$cshowsPrec :: Int -> AssignInstanceResponse -> ShowS
Prelude.Show, (forall x. AssignInstanceResponse -> Rep AssignInstanceResponse x)
-> (forall x.
Rep AssignInstanceResponse x -> AssignInstanceResponse)
-> Generic AssignInstanceResponse
forall x. Rep AssignInstanceResponse x -> AssignInstanceResponse
forall x. AssignInstanceResponse -> Rep AssignInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssignInstanceResponse x -> AssignInstanceResponse
$cfrom :: forall x. AssignInstanceResponse -> Rep AssignInstanceResponse x
Prelude.Generic)
newAssignInstanceResponse ::
AssignInstanceResponse
newAssignInstanceResponse :: AssignInstanceResponse
newAssignInstanceResponse = AssignInstanceResponse
AssignInstanceResponse'
instance Prelude.NFData AssignInstanceResponse