Class Manifests
- java.lang.Object
-
- com.google.jenkins.plugins.k8sengine.Manifests
-
public class Manifests extends Object
Utility library for loading Kubernetes manifests files from aFilePath
into a list of descriptive wrappers,Manifests.ManifestObject
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Manifests.ManifestObject
ManifestObject wrapper that encapsulates an object spec loaded from a supplied manifest.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Manifests
fromFile(FilePath file)
Factory method for singleFilePath
.static Manifests
fromFileList(List<FilePath> files)
Factory method for list ofFilePath
objects.List<Manifests.ManifestObject>
getObjectManifests()
List<Manifests.ManifestObject>
getObjectManifestsOfKinds(Set<String> includedKinds)
Get the list ofManifests.ManifestObject
that match the given kind.void
write()
Writes the contents of thisManifests
's objects back to their corresponding files.
-
-
-
Method Detail
-
fromFile
public static Manifests fromFile(FilePath file) throws IOException, InterruptedException
Factory method for singleFilePath
.- Parameters:
file
- TheFilePath
containing the manifests.- Returns:
- A
Manifests
object containing the individual manifests contained at the file path. - Throws:
IOException
- If an error occurred while loading the file.InterruptedException
- If a threading error occurred while loading the file.
-
fromFileList
public static Manifests fromFileList(List<FilePath> files) throws IOException, InterruptedException
Factory method for list ofFilePath
objects.- Parameters:
files
- The list ofFilePath
objects containing the manifests.- Returns:
- Manifests object constructed based on the list of
FilePath
's. - Throws:
IOException
- If an error occurred while loading the file.InterruptedException
- If a threading error occurred while loading the file.
-
getObjectManifests
public List<Manifests.ManifestObject> getObjectManifests()
- Returns:
- The
Manifests.ManifestObject
's that were loaded.
-
getObjectManifestsOfKinds
public List<Manifests.ManifestObject> getObjectManifestsOfKinds(Set<String> includedKinds)
Get the list ofManifests.ManifestObject
that match the given kind.- Parameters:
includedKinds
- The kinds of Kubernetes objects to include in the list.- Returns:
- The manifest objects that match the included kinds.
-
write
public void write() throws InterruptedException, IOException
Writes the contents of thisManifests
's objects back to their corresponding files.- Throws:
InterruptedException
- If an error occurred while dumping to YAML.IOException
- If an error occurred while writing the file contents.
-
-