{-# 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.Lens as Lens
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
(AssociateNode -> AssociateNode -> Bool)
-> (AssociateNode -> AssociateNode -> Bool) -> Eq AssociateNode
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
(Int -> AssociateNode -> ShowS)
-> (AssociateNode -> String)
-> ([AssociateNode] -> ShowS)
-> Show AssociateNode
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. AssociateNode -> Rep AssociateNode x)
-> (forall x. Rep AssociateNode x -> AssociateNode)
-> Generic AssociateNode
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' :: Text -> Text -> [EngineAttribute] -> AssociateNode
AssociateNode'
{ $sel:serverName:AssociateNode' :: Text
serverName = Text
pServerName_,
$sel:nodeName:AssociateNode' :: Text
nodeName = Text
pNodeName_,
$sel:engineAttributes:AssociateNode' :: [EngineAttribute]
engineAttributes = [EngineAttribute]
forall a. Monoid a => a
Prelude.mempty
}
associateNode_serverName :: Lens.Lens' AssociateNode Prelude.Text
associateNode_serverName :: (Text -> f Text) -> AssociateNode -> f AssociateNode
associateNode_serverName = (AssociateNode -> Text)
-> (AssociateNode -> Text -> AssociateNode)
-> Lens AssociateNode AssociateNode Text Text
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 :: (Text -> f Text) -> AssociateNode -> f AssociateNode
associateNode_nodeName = (AssociateNode -> Text)
-> (AssociateNode -> Text -> AssociateNode)
-> Lens AssociateNode AssociateNode Text Text
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 :: ([EngineAttribute] -> f [EngineAttribute])
-> AssociateNode -> f AssociateNode
associateNode_engineAttributes = (AssociateNode -> [EngineAttribute])
-> (AssociateNode -> [EngineAttribute] -> AssociateNode)
-> Lens
AssociateNode AssociateNode [EngineAttribute] [EngineAttribute]
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) (([EngineAttribute] -> f [EngineAttribute])
-> AssociateNode -> f AssociateNode)
-> (([EngineAttribute] -> f [EngineAttribute])
-> [EngineAttribute] -> f [EngineAttribute])
-> ([EngineAttribute] -> f [EngineAttribute])
-> AssociateNode
-> f AssociateNode
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EngineAttribute] -> f [EngineAttribute])
-> [EngineAttribute] -> f [EngineAttribute]
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 :: AssociateNode -> Request AssociateNode
request = Service -> AssociateNode -> Request AssociateNode
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateNode
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateNode)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateNode))
-> Logger
-> Service
-> Proxy AssociateNode
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AssociateNode)))
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 -> Int -> AssociateNodeResponse
AssociateNodeResponse'
(Maybe Text -> Int -> AssociateNodeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateNodeResponse)
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
"NodeAssociationStatusToken")
Either String (Int -> AssociateNodeResponse)
-> Either String Int -> Either String AssociateNodeResponse
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 AssociateNode
instance Prelude.NFData AssociateNode
instance Core.ToHeaders AssociateNode where
toHeaders :: AssociateNode -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateNode -> 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
"OpsWorksCM_V2016_11_01.AssociateNode" ::
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 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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"NodeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
nodeName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"EngineAttributes" Text -> [EngineAttribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [EngineAttribute]
engineAttributes)
]
)
instance Core.ToPath AssociateNode where
toPath :: AssociateNode -> ByteString
toPath = ByteString -> AssociateNode -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AssociateNode where
toQuery :: AssociateNode -> QueryString
toQuery = QueryString -> AssociateNode -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(AssociateNodeResponse -> AssociateNodeResponse -> Bool)
-> (AssociateNodeResponse -> AssociateNodeResponse -> Bool)
-> Eq AssociateNodeResponse
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]
(Int -> ReadS AssociateNodeResponse)
-> ReadS [AssociateNodeResponse]
-> ReadPrec AssociateNodeResponse
-> ReadPrec [AssociateNodeResponse]
-> Read 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
(Int -> AssociateNodeResponse -> ShowS)
-> (AssociateNodeResponse -> String)
-> ([AssociateNodeResponse] -> ShowS)
-> Show AssociateNodeResponse
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. AssociateNodeResponse -> Rep AssociateNodeResponse x)
-> (forall x. Rep AssociateNodeResponse x -> AssociateNodeResponse)
-> Generic AssociateNodeResponse
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' :: Maybe Text -> Int -> AssociateNodeResponse
AssociateNodeResponse'
{ $sel:nodeAssociationStatusToken:AssociateNodeResponse' :: Maybe Text
nodeAssociationStatusToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateNodeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateNodeResponse_nodeAssociationStatusToken :: Lens.Lens' AssociateNodeResponse (Prelude.Maybe Prelude.Text)
associateNodeResponse_nodeAssociationStatusToken :: (Maybe Text -> f (Maybe Text))
-> AssociateNodeResponse -> f AssociateNodeResponse
associateNodeResponse_nodeAssociationStatusToken = (AssociateNodeResponse -> Maybe Text)
-> (AssociateNodeResponse -> Maybe Text -> AssociateNodeResponse)
-> Lens
AssociateNodeResponse
AssociateNodeResponse
(Maybe Text)
(Maybe Text)
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 :: (Int -> f Int) -> AssociateNodeResponse -> f AssociateNodeResponse
associateNodeResponse_httpStatus = (AssociateNodeResponse -> Int)
-> (AssociateNodeResponse -> Int -> AssociateNodeResponse)
-> Lens AssociateNodeResponse AssociateNodeResponse Int Int
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