diff options
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r-- | libpod/in_memory_state.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go index 66c2a5cbd..3b88c9664 100644 --- a/libpod/in_memory_state.go +++ b/libpod/in_memory_state.go @@ -568,6 +568,25 @@ func (s *InMemoryState) GetNetworkAliases(ctr *Container, network string) ([]str return netAliases, nil } +// GetAllNetworkAliases gets all network aliases for the given container. +func (s *InMemoryState) GetAllNetworkAliases(ctr *Container) (map[string][]string, error) { + if !ctr.valid { + return nil, define.ErrCtrRemoved + } + + ctr, ok := s.containers[ctr.ID()] + if !ok { + return nil, define.ErrNoSuchCtr + } + + ctrAliases, ok := s.ctrNetworkAliases[ctr.ID()] + if !ok { + return map[string][]string{}, nil + } + + return ctrAliases, nil +} + // SetNetworkAliases sets network aliases for the given container in the given // network. func (s *InMemoryState) SetNetworkAliases(ctr *Container, network string, aliases []string) error { |