Copyright | (c) 2015-2016 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay@gmail.com> |
Stability | provisional |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Language | Haskell2010 |
Google Compute Engine defines a set of default metadata entries that provide information about your instance or project.
This module contains functions for retrieving various Compute metadata from an
instance's local metadata endpoint using MonadIO
, prior to initialisation
of the environment used by the Network.Google monad.
Synopsis
- checkGCEVar :: String
- isGCE :: MonadIO m => Manager -> m Bool
- getProjectAttribute :: MonadIO m => Text -> Manager -> m (Maybe ByteString)
- getSSHKeys :: MonadIO m => Manager -> m [Text]
- getNumericProjectId :: MonadIO m => Manager -> m Text
- getProjectId :: MonadIO m => Manager -> m Text
- getInstanceAttribute :: MonadIO m => Text -> Manager -> m (Maybe ByteString)
- getDescription :: MonadIO m => Manager -> m Text
- getHostname :: MonadIO m => Manager -> m Text
- getInstanceId :: MonadIO m => Manager -> m Text
- getMachineType :: MonadIO m => Manager -> m Text
- getTags :: MonadIO m => Manager -> m [Text]
- getZone :: MonadIO m => Manager -> m Text
- metadataFlavorHeader :: HeaderName
- metadataFlavorDesired :: ByteString
- metadataRequest :: Request
- getMetadata :: MonadIO m => ByteString -> [Int] -> Manager -> m (Response ByteString)
Google Compute Instance Check
checkGCEVar :: String Source #
The NO_GCE_CHECK
environment variable.
isGCE :: MonadIO m => Manager -> m Bool Source #
Detect if the underlying host is running on GCE.
The environment variable NO_GCE_CHECK
can be set to 1
, true
, yes
, or on
to skip this check and always return False
.
Retrieving Metadata
getProjectAttribute :: MonadIO m => Text -> Manager -> m (Maybe ByteString) Source #
A directory of custom metadata values that have been set for this project.
getSSHKeys :: MonadIO m => Manager -> m [Text] Source #
SSH keys that can connect to instances in the project. SSH keys for Compute
Engine use a specialized format where the keys are prepended with a username,
like so: user1:ssh-rsa my-public-ssh-key user1
host.com@
getNumericProjectId :: MonadIO m => Manager -> m Text Source #
The numeric project ID of the instance, which is not the same as the project name visible in the Google Developers Console. This value is different from the project-id metadata entry value. The project-id value is required for all requests to the Compute Engine service.
getProjectId :: MonadIO m => Manager -> m Text Source #
The project ID.
getInstanceAttribute :: MonadIO m => Text -> Manager -> m (Maybe ByteString) Source #
A directory of custom metadata values passed to the instance during startup or shutdown.
getDescription :: MonadIO m => Manager -> m Text Source #
The free-text description of an instance, assigned using the
--description
flag, or set in the API.
getHostname :: MonadIO m => Manager -> m Text Source #
The host name of the instance.
getInstanceId :: MonadIO m => Manager -> m Text Source #
The ID of the instance. This is a unique, numerical ID that is generated by Google Compute Engine. This is useful for identifying instances if you do not want to use instance names.
getMachineType :: MonadIO m => Manager -> m Text Source #
The fully-qualified machine type name of the instance's host machine.
Raw Metadata Requests
metadataFlavorHeader :: HeaderName Source #
The Metadata-Flavor
header.
metadataFlavorDesired :: ByteString Source #
The desired metadata flavor.
metadataRequest :: Request Source #
A default http-client
Request
with the host, port, and headers
set appropriately for metadata.google.internal
use.
:: MonadIO m | |
=> ByteString | The request path. |
-> [Int] | Acceptable status code responses. |
-> Manager | |
-> m (Response ByteString) |