module Network.AWS.OpsWorks.RegisterInstance
(
RegisterInstance
, registerInstance
, riHostname
, riInstanceIdentity
, riPrivateIp
, riPublicIp
, riRsaPublicKey
, riRsaPublicKeyFingerprint
, riStackId
, RegisterInstanceResponse
, registerInstanceResponse
, rirInstanceId
) where
import Network.AWS.Data (Object)
import Network.AWS.Prelude
import Network.AWS.Request.JSON
import Network.AWS.OpsWorks.Types
import qualified GHC.Exts
data RegisterInstance = RegisterInstance
{ _riHostname :: Maybe Text
, _riInstanceIdentity :: Maybe InstanceIdentity
, _riPrivateIp :: Maybe Text
, _riPublicIp :: Maybe Text
, _riRsaPublicKey :: Maybe Text
, _riRsaPublicKeyFingerprint :: Maybe Text
, _riStackId :: Text
} deriving (Eq, Read, Show)
registerInstance :: Text
-> RegisterInstance
registerInstance p1 = RegisterInstance
{ _riStackId = p1
, _riHostname = Nothing
, _riPublicIp = Nothing
, _riPrivateIp = Nothing
, _riRsaPublicKey = Nothing
, _riRsaPublicKeyFingerprint = Nothing
, _riInstanceIdentity = Nothing
}
riHostname :: Lens' RegisterInstance (Maybe Text)
riHostname = lens _riHostname (\s a -> s { _riHostname = a })
riInstanceIdentity :: Lens' RegisterInstance (Maybe InstanceIdentity)
riInstanceIdentity =
lens _riInstanceIdentity (\s a -> s { _riInstanceIdentity = a })
riPrivateIp :: Lens' RegisterInstance (Maybe Text)
riPrivateIp = lens _riPrivateIp (\s a -> s { _riPrivateIp = a })
riPublicIp :: Lens' RegisterInstance (Maybe Text)
riPublicIp = lens _riPublicIp (\s a -> s { _riPublicIp = a })
riRsaPublicKey :: Lens' RegisterInstance (Maybe Text)
riRsaPublicKey = lens _riRsaPublicKey (\s a -> s { _riRsaPublicKey = a })
riRsaPublicKeyFingerprint :: Lens' RegisterInstance (Maybe Text)
riRsaPublicKeyFingerprint =
lens _riRsaPublicKeyFingerprint
(\s a -> s { _riRsaPublicKeyFingerprint = a })
riStackId :: Lens' RegisterInstance Text
riStackId = lens _riStackId (\s a -> s { _riStackId = a })
newtype RegisterInstanceResponse = RegisterInstanceResponse
{ _rirInstanceId :: Maybe Text
} deriving (Eq, Ord, Read, Show, Monoid)
registerInstanceResponse :: RegisterInstanceResponse
registerInstanceResponse = RegisterInstanceResponse
{ _rirInstanceId = Nothing
}
rirInstanceId :: Lens' RegisterInstanceResponse (Maybe Text)
rirInstanceId = lens _rirInstanceId (\s a -> s { _rirInstanceId = a })
instance ToPath RegisterInstance where
toPath = const "/"
instance ToQuery RegisterInstance where
toQuery = const mempty
instance ToHeaders RegisterInstance
instance ToJSON RegisterInstance where
toJSON RegisterInstance{..} = object
[ "StackId" .= _riStackId
, "Hostname" .= _riHostname
, "PublicIp" .= _riPublicIp
, "PrivateIp" .= _riPrivateIp
, "RsaPublicKey" .= _riRsaPublicKey
, "RsaPublicKeyFingerprint" .= _riRsaPublicKeyFingerprint
, "InstanceIdentity" .= _riInstanceIdentity
]
instance AWSRequest RegisterInstance where
type Sv RegisterInstance = OpsWorks
type Rs RegisterInstance = RegisterInstanceResponse
request = post "RegisterInstance"
response = jsonResponse
instance FromJSON RegisterInstanceResponse where
parseJSON = withObject "RegisterInstanceResponse" $ \o -> RegisterInstanceResponse
<$> o .:? "InstanceId"