Vendor integration dependencies.
This commit is contained in:
parent
dd5e3fba01
commit
55b57c736b
2451 changed files with 731611 additions and 0 deletions
44
integration/vendor/github.com/docker/libcompose/yaml/external.go
generated
vendored
Normal file
44
integration/vendor/github.com/docker/libcompose/yaml/external.go
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
package yaml
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// External represents an external network entry in compose file.
|
||||
// It can be a boolean (true|false) or have a name
|
||||
type External struct {
|
||||
External bool
|
||||
Name string
|
||||
}
|
||||
|
||||
// MarshalYAML implements the Marshaller interface.
|
||||
func (n External) MarshalYAML() (tag string, value interface{}, err error) {
|
||||
if n.Name == "" {
|
||||
return "", n.External, nil
|
||||
}
|
||||
return "", map[string]interface{}{
|
||||
"name": n.Name,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UnmarshalYAML implements the Unmarshaller interface.
|
||||
func (n *External) UnmarshalYAML(tag string, value interface{}) error {
|
||||
switch v := value.(type) {
|
||||
case bool:
|
||||
n.External = v
|
||||
case map[interface{}]interface{}:
|
||||
for mapKey, mapValue := range v {
|
||||
switch mapKey {
|
||||
case "name":
|
||||
n.Name = mapValue.(string)
|
||||
default:
|
||||
// Ignore unknown keys
|
||||
continue
|
||||
}
|
||||
}
|
||||
n.External = true
|
||||
default:
|
||||
return fmt.Errorf("Failed to unmarshal External: %#v", value)
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue