forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCreateConfigCmdImpl.java
More file actions
63 lines (49 loc) · 1.49 KB
/
Copy pathCreateConfigCmdImpl.java
File metadata and controls
63 lines (49 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.github.dockerjava.core.command;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.dockerjava.api.command.CreateConfigCmd;
import com.github.dockerjava.api.command.CreateConfigResponse;
import java.util.Base64;
import java.util.Map;
import java.util.Objects;
/**
* Creates a new config
*/
public class CreateConfigCmdImpl extends AbstrDockerCmd<CreateConfigCmd, CreateConfigResponse> implements CreateConfigCmd {
@JsonProperty("Name")
private String name;
@JsonProperty("Data")
private String data;
@JsonProperty("Labels")
private Map<String, String> labels;
@Override
public String getName() {
return name;
}
@Override
public String getData() {
return data;
}
@Override
public Map<String, String> getLabels() {
return labels;
}
public CreateConfigCmdImpl(CreateConfigCmd.Exec exec) {
super(exec);
}
@Override
public CreateConfigCmd withName(String name) {
this.name = Objects.requireNonNull(name, "name was not specified");
return this;
}
@Override
public CreateConfigCmd withData(byte[] data) {
Objects.requireNonNull(data, "data was not specified");
this.data = Base64.getEncoder().encodeToString(data);
return this;
}
@Override
public CreateConfigCmd withLabels(Map<String, String> labels) {
this.labels = Objects.requireNonNull(labels, "labels was not specified");
return this;
}
}