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
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
FieldsModifier and TypeFieldDescriptionstatic final String
The address of the GCE Metadata service that provides GCE instances with information about the default service account. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Are we on a Google Compute Engine instance?readMetadata
(String metadataPath) Reads the specified sub-element out of the Google Compute Engine instance's metadata.
-
Field Details
-
METADATA_SERVER
The address of the GCE Metadata service that provides GCE instances with information about the default service account.- See Also:
-
-
Constructor Details
-
Default
public Default() -
Default
public Default(com.google.api.client.http.HttpRequestFactory requestFactory)
-
-
Method Details
-
readMetadata
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
-