{-# 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.OpsWorksCM.AssociateNode
(
AssociateNode (..),
newAssociateNode,
associateNode_serverName,
associateNode_nodeName,
associateNode_engineAttributes,
AssociateNodeResponse (..),
newAssociateNodeResponse,
associateNodeResponse_nodeAssociationStatusToken,
associateNodeResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.OpsWorksCM.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AssociateNode = AssociateNode'
{
AssociateNode -> Text
serverName :: Prelude.Text,
AssociateNode -> Text
nodeName :: Prelude.Text,
AssociateNode -> [EngineAttribute]
engineAttributes :: [EngineAttribute]
}
deriving (AssociateNode -> AssociateNode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateNode -> AssociateNode -> Bool
$c/= :: AssociateNode -> AssociateNode -> Bool
== :: AssociateNode -> AssociateNode -> Bool
$c== :: AssociateNode -> AssociateNode -> Bool
Prelude.Eq, Int -> AssociateNode -> ShowS
[AssociateNode] -> ShowS
AssociateNode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateNode] -> ShowS
$cshowList :: [AssociateNode] -> ShowS
show :: AssociateNode -> String
$cshow :: AssociateNode -> String
showsPrec :: Int -> AssociateNode -> ShowS
$cshowsPrec :: Int -> AssociateNode -> ShowS
Prelude.Show, forall x. Rep AssociateNode x -> AssociateNode
forall x. AssociateNode -> Rep AssociateNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateNode x -> AssociateNode
$cfrom :: forall x. AssociateNode -> Rep AssociateNode x
Prelude.Generic)
newAssociateNode ::
Prelude.Text ->
Prelude.Text ->
AssociateNode
newAssociateNode :: Text -> Text -> AssociateNode
newAssociateNode Text
pServerName_ Text
pNodeName_ =
AssociateNode'
{ $sel:serverName:AssociateNode' :: Text
serverName = Text
pServerName_,
$sel:nodeName:AssociateNode' :: Text
nodeName = Text
pNodeName_,
$sel:engineAttributes:AssociateNode' :: [EngineAttribute]
engineAttributes = forall a. Monoid a => a
Prelude.mempty
}
associateNode_serverName :: Lens.Lens' AssociateNode Prelude.Text
associateNode_serverName :: Lens' AssociateNode Text
associateNode_serverName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNode' {Text
serverName :: Text
$sel:serverName:AssociateNode' :: AssociateNode -> Text
serverName} -> Text
serverName) (\s :: AssociateNode
s@AssociateNode' {} Text
a -> AssociateNode
s {$sel:serverName:AssociateNode' :: Text
serverName = Text
a} :: AssociateNode)
associateNode_nodeName :: Lens.Lens' AssociateNode Prelude.Text
associateNode_nodeName :: Lens' AssociateNode Text
associateNode_nodeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNode' {Text
nodeName :: Text
$sel:nodeName:AssociateNode' :: AssociateNode -> Text
nodeName} -> Text
nodeName) (\s :: AssociateNode
s@AssociateNode' {} Text
a -> AssociateNode
s {$sel:nodeName:AssociateNode' :: Text
nodeName = Text
a} :: AssociateNode)
associateNode_engineAttributes :: Lens.Lens' AssociateNode [EngineAttribute]
associateNode_engineAttributes :: Lens' AssociateNode [EngineAttribute]
associateNode_engineAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNode' {[EngineAttribute]
engineAttributes :: [EngineAttribute]
$sel:engineAttributes:AssociateNode' :: AssociateNode -> [EngineAttribute]
engineAttributes} -> [EngineAttribute]
engineAttributes) (\s :: AssociateNode
s@AssociateNode' {} [EngineAttribute]
a -> AssociateNode
s {$sel:engineAttributes:AssociateNode' :: [EngineAttribute]
engineAttributes = [EngineAttribute]
a} :: AssociateNode) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AssociateNode where
type
AWSResponse AssociateNode =
AssociateNodeResponse
request :: (Service -> Service) -> AssociateNode -> Request AssociateNode
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 AssociateNode
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateNode)))
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 Text -> Int -> AssociateNodeResponse
AssociateNodeResponse'
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
"NodeAssociationStatusToken")
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 AssociateNode where
hashWithSalt :: Int -> AssociateNode -> Int
hashWithSalt Int
_salt AssociateNode' {[EngineAttribute]
Text
engineAttributes :: [EngineAttribute]
nodeName :: Text
serverName :: Text
$sel:engineAttributes:AssociateNode' :: AssociateNode -> [EngineAttribute]
$sel:nodeName:AssociateNode' :: AssociateNode -> Text
$sel:serverName:AssociateNode' :: AssociateNode -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serverName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
nodeName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [EngineAttribute]
engineAttributes
instance Prelude.NFData AssociateNode where
rnf :: AssociateNode -> ()
rnf AssociateNode' {[EngineAttribute]
Text
engineAttributes :: [EngineAttribute]
nodeName :: Text
serverName :: Text
$sel:engineAttributes:AssociateNode' :: AssociateNode -> [EngineAttribute]
$sel:nodeName:AssociateNode' :: AssociateNode -> Text
$sel:serverName:AssociateNode' :: AssociateNode -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
serverName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
nodeName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [EngineAttribute]
engineAttributes
instance Data.ToHeaders AssociateNode where
toHeaders :: AssociateNode -> 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
"OpsWorksCM_V2016_11_01.AssociateNode" ::
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 AssociateNode where
toJSON :: AssociateNode -> Value
toJSON AssociateNode' {[EngineAttribute]
Text
engineAttributes :: [EngineAttribute]
nodeName :: Text
serverName :: Text
$sel:engineAttributes:AssociateNode' :: AssociateNode -> [EngineAttribute]
$sel:nodeName:AssociateNode' :: AssociateNode -> Text
$sel:serverName:AssociateNode' :: AssociateNode -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"ServerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serverName),
forall a. a -> Maybe a
Prelude.Just (Key
"NodeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
nodeName),
forall a. a -> Maybe a
Prelude.Just
(Key
"EngineAttributes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [EngineAttribute]
engineAttributes)
]
)
instance Data.ToPath AssociateNode where
toPath :: AssociateNode -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery AssociateNode where
toQuery :: AssociateNode -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data AssociateNodeResponse = AssociateNodeResponse'
{
AssociateNodeResponse -> Maybe Text
nodeAssociationStatusToken :: Prelude.Maybe Prelude.Text,
AssociateNodeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateNodeResponse -> AssociateNodeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateNodeResponse -> AssociateNodeResponse -> Bool
$c/= :: AssociateNodeResponse -> AssociateNodeResponse -> Bool
== :: AssociateNodeResponse -> AssociateNodeResponse -> Bool
$c== :: AssociateNodeResponse -> AssociateNodeResponse -> Bool
Prelude.Eq, ReadPrec [AssociateNodeResponse]
ReadPrec AssociateNodeResponse
Int -> ReadS AssociateNodeResponse
ReadS [AssociateNodeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateNodeResponse]
$creadListPrec :: ReadPrec [AssociateNodeResponse]
readPrec :: ReadPrec AssociateNodeResponse
$creadPrec :: ReadPrec AssociateNodeResponse
readList :: ReadS [AssociateNodeResponse]
$creadList :: ReadS [AssociateNodeResponse]
readsPrec :: Int -> ReadS AssociateNodeResponse
$creadsPrec :: Int -> ReadS AssociateNodeResponse
Prelude.Read, Int -> AssociateNodeResponse -> ShowS
[AssociateNodeResponse] -> ShowS
AssociateNodeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateNodeResponse] -> ShowS
$cshowList :: [AssociateNodeResponse] -> ShowS
show :: AssociateNodeResponse -> String
$cshow :: AssociateNodeResponse -> String
showsPrec :: Int -> AssociateNodeResponse -> ShowS
$cshowsPrec :: Int -> AssociateNodeResponse -> ShowS
Prelude.Show, forall x. Rep AssociateNodeResponse x -> AssociateNodeResponse
forall x. AssociateNodeResponse -> Rep AssociateNodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateNodeResponse x -> AssociateNodeResponse
$cfrom :: forall x. AssociateNodeResponse -> Rep AssociateNodeResponse x
Prelude.Generic)
newAssociateNodeResponse ::
Prelude.Int ->
AssociateNodeResponse
newAssociateNodeResponse :: Int -> AssociateNodeResponse
newAssociateNodeResponse Int
pHttpStatus_ =
AssociateNodeResponse'
{ $sel:nodeAssociationStatusToken:AssociateNodeResponse' :: Maybe Text
nodeAssociationStatusToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateNodeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateNodeResponse_nodeAssociationStatusToken :: Lens.Lens' AssociateNodeResponse (Prelude.Maybe Prelude.Text)
associateNodeResponse_nodeAssociationStatusToken :: Lens' AssociateNodeResponse (Maybe Text)
associateNodeResponse_nodeAssociationStatusToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNodeResponse' {Maybe Text
nodeAssociationStatusToken :: Maybe Text
$sel:nodeAssociationStatusToken:AssociateNodeResponse' :: AssociateNodeResponse -> Maybe Text
nodeAssociationStatusToken} -> Maybe Text
nodeAssociationStatusToken) (\s :: AssociateNodeResponse
s@AssociateNodeResponse' {} Maybe Text
a -> AssociateNodeResponse
s {$sel:nodeAssociationStatusToken:AssociateNodeResponse' :: Maybe Text
nodeAssociationStatusToken = Maybe Text
a} :: AssociateNodeResponse)
associateNodeResponse_httpStatus :: Lens.Lens' AssociateNodeResponse Prelude.Int
associateNodeResponse_httpStatus :: Lens' AssociateNodeResponse Int
associateNodeResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateNodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateNodeResponse' :: AssociateNodeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateNodeResponse
s@AssociateNodeResponse' {} Int
a -> AssociateNodeResponse
s {$sel:httpStatus:AssociateNodeResponse' :: Int
httpStatus = Int
a} :: AssociateNodeResponse)
instance Prelude.NFData AssociateNodeResponse where
rnf :: AssociateNodeResponse -> ()
rnf AssociateNodeResponse' {Int
Maybe Text
httpStatus :: Int
nodeAssociationStatusToken :: Maybe Text
$sel:httpStatus:AssociateNodeResponse' :: AssociateNodeResponse -> Int
$sel:nodeAssociationStatusToken:AssociateNodeResponse' :: AssociateNodeResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nodeAssociationStatusToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus