-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support for volume API #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/github/dockerjava/api/command/CreateVolumeCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import javax.annotation.CheckForNull; | ||
|
|
||
| public interface CreateVolumeCmd extends SyncDockerCmd<CreateVolumeResponse> { | ||
|
|
||
| @CheckForNull | ||
| public String getName(); | ||
|
|
||
| @CheckForNull | ||
| public String getDriver(); | ||
|
|
||
| @CheckForNull | ||
| public Map<String, String> getDriverOpts(); | ||
|
|
||
| /** | ||
| * @param name | ||
| * - The new volume’s name. If not specified, Docker generates a name. | ||
| */ | ||
| public CreateVolumeCmd withName(String name); | ||
|
|
||
| /** | ||
| * @param driver | ||
| * - Name of the volume driver to use. Defaults to local for the name. | ||
| */ | ||
| public CreateVolumeCmd withDriver(String driver); | ||
|
|
||
| /** | ||
| * @param driverOpts | ||
| * - A mapping of driver options and values. These options are passed directly to the driver and are | ||
| * driver specific. | ||
| */ | ||
| public CreateVolumeCmd withDriverOpts(Map<String, String> driverOpts); | ||
|
|
||
| public static interface Exec extends DockerCmdSyncExec<CreateVolumeCmd, CreateVolumeResponse> { | ||
| } | ||
| } | ||
|
|
||
40 changes: 40 additions & 0 deletions
40
src/main/java/com/github/dockerjava/api/command/CreateVolumeResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import org.apache.commons.lang.builder.ToStringBuilder; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * | ||
| * @author Marcus Linke | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class CreateVolumeResponse { | ||
|
|
||
| @JsonProperty("Name") | ||
| private String name; | ||
|
|
||
| @JsonProperty("Driver") | ||
| private String driver; | ||
|
|
||
| @JsonProperty("Mountpoint") | ||
| private String mountpoint; | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getDriver() { | ||
| return driver; | ||
| } | ||
|
|
||
| public String getMountpoint() { | ||
| return mountpoint; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return ToStringBuilder.reflectionToString(this); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/github/dockerjava/api/command/InspectVolumeCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
|
|
||
| /** | ||
| * Inspect the details of a volume. | ||
| * | ||
| * @author Marcus Linke | ||
| * | ||
| */ | ||
| public interface InspectVolumeCmd extends SyncDockerCmd<InspectVolumeResponse> { | ||
|
|
||
| public String getName(); | ||
|
|
||
| /** | ||
| * @param name | ||
| * - The volume’s name. | ||
| */ | ||
| public InspectVolumeCmd withName(@Nonnull String name); | ||
|
|
||
| public static interface Exec extends DockerCmdSyncExec<InspectVolumeCmd, InspectVolumeResponse> { | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/github/dockerjava/api/command/InspectVolumeResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import org.apache.commons.lang.builder.ToStringBuilder; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * | ||
| * @author Marcus Linke | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class InspectVolumeResponse { | ||
|
|
||
| @JsonProperty("Name") | ||
| private String name; | ||
|
|
||
| @JsonProperty("Driver") | ||
| private String driver; | ||
|
|
||
| @JsonProperty("Mountpoint") | ||
| private String mountpoint; | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getDriver() { | ||
| return driver; | ||
| } | ||
|
|
||
| public String getMountpoint() { | ||
| return mountpoint; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return ToStringBuilder.reflectionToString(this); | ||
| } | ||
| } |
25 changes: 25 additions & 0 deletions
25
src/main/java/com/github/dockerjava/api/command/ListVolumesCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import javax.annotation.CheckForNull; | ||
|
|
||
| /** | ||
| * List volumes. | ||
| * | ||
| * | ||
| * @author Marcus Linke | ||
| */ | ||
| public interface ListVolumesCmd extends SyncDockerCmd<ListVolumesResponse> { | ||
|
|
||
| @CheckForNull | ||
| public String getFilters(); | ||
|
|
||
| /** | ||
| * @param filters | ||
| * - JSON encoded value of the filters (a map[string][]string) to process on the volumes list. There is | ||
| * one available filter: dangling=true | ||
| */ | ||
| public ListVolumesCmd withFilters(String filters); | ||
|
|
||
| public static interface Exec extends DockerCmdSyncExec<ListVolumesCmd, ListVolumesResponse> { | ||
| } | ||
| } |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/github/dockerjava/api/command/ListVolumesResponse.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import org.apache.commons.lang.builder.ToStringBuilder; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * | ||
| * @author Marcus Linke | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class ListVolumesResponse { | ||
|
|
||
| @JsonProperty("Volumes") | ||
| private List<InspectVolumeResponse> volumes; | ||
|
|
||
| public List<InspectVolumeResponse> getVolumes() { | ||
| return volumes; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return ToStringBuilder.reflectionToString(this); | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
src/main/java/com/github/dockerjava/api/command/RemoveVolumeCmd.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package com.github.dockerjava.api.command; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
|
|
||
| import com.github.dockerjava.api.exception.ConflictException; | ||
| import com.github.dockerjava.api.exception.NotFoundException; | ||
|
|
||
| /** | ||
| * Remove a volume. | ||
| * | ||
| * @author Marcus Linke | ||
| */ | ||
| public interface RemoveVolumeCmd extends SyncDockerCmd<Void> { | ||
|
|
||
| public String getName(); | ||
|
|
||
| public RemoveVolumeCmd withName(@Nonnull String name); | ||
|
|
||
| /** | ||
| * @throws NotFoundException | ||
| * No such volume | ||
| * @throws ConflictException | ||
| * Volume is in use and cannot be removed | ||
| */ | ||
| @Override | ||
| public Void exec() throws NotFoundException; | ||
|
|
||
| public static interface Exec extends DockerCmdSyncExec<RemoveVolumeCmd, Void> { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add javadoc when apparead? 1.21?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can do myself later.