Package com.google.jenkins.plugins.util
Class MetadataReader.Default
- java.lang.Object
-
- com.google.jenkins.plugins.util.MetadataReader.Default
-
- All Implemented Interfaces:
MetadataReader
- Enclosing interface:
- MetadataReader
public static class MetadataReader.Default extends Object implements MetadataReader
A simple default implementation that reads metadata via http requests.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.jenkins.plugins.util.MetadataReader
MetadataReader.Default
-
-
Field Summary
Fields Modifier and Type Field Description static String
METADATA_SERVER
The address of the GCE Metadata service that provides GCE instances with information about the default service account.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasMetadata()
Are we on a Google Compute Engine instance?String
readMetadata(String metadataPath)
Reads the specified sub-element out of the Google Compute Engine instance's metadata.
-
-
-
Field Detail
-
METADATA_SERVER
public static final String METADATA_SERVER
The address of the GCE Metadata service that provides GCE instances with information about the default service account.- See Also:
- Constant Field Values
-
-
Method Detail
-
readMetadata
public String readMetadata(String metadataPath) throws IOException, ExecutorException
Reads the specified sub-element out of the Google Compute Engine instance's metadata. These relative paths are expected to start with:- /instance/...
- /project/...
- Specified by:
readMetadata
in interfaceMetadataReader
- Throws:
IOException
ExecutorException
-
hasMetadata
public boolean hasMetadata()
Are we on a Google Compute Engine instance?- Specified by:
hasMetadata
in interfaceMetadataReader
-
-