mirror of https://github.com/docker/cli.git
cli/command/network: runCreate: inline types.NetworkCreate
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cdba442d00
commit
2294b17e7d
|
@ -92,8 +92,13 @@ func runCreate(dockerCli command.Cli, options createOptions) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct network create request body
|
var configFrom *network.ConfigReference
|
||||||
nc := types.NetworkCreate{
|
if options.configFrom != "" {
|
||||||
|
configFrom = &network.ConfigReference{
|
||||||
|
Network: options.configFrom,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resp, err := client.NetworkCreate(context.Background(), options.name, types.NetworkCreate{
|
||||||
Driver: options.driver,
|
Driver: options.driver,
|
||||||
Options: options.driverOpts.GetAll(),
|
Options: options.driverOpts.GetAll(),
|
||||||
IPAM: &network.IPAM{
|
IPAM: &network.IPAM{
|
||||||
|
@ -107,16 +112,9 @@ func runCreate(dockerCli command.Cli, options createOptions) error {
|
||||||
Ingress: options.ingress,
|
Ingress: options.ingress,
|
||||||
Scope: options.scope,
|
Scope: options.scope,
|
||||||
ConfigOnly: options.configOnly,
|
ConfigOnly: options.configOnly,
|
||||||
|
ConfigFrom: configFrom,
|
||||||
Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()),
|
Labels: opts.ConvertKVStringsToMap(options.labels.GetAll()),
|
||||||
}
|
})
|
||||||
|
|
||||||
if from := options.configFrom; from != "" {
|
|
||||||
nc.ConfigFrom = &network.ConfigReference{
|
|
||||||
Network: from,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resp, err := client.NetworkCreate(context.Background(), options.name, nc)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue