Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
17c6e05e
Kaydet (Commit)
17c6e05e
authored
Ara 19, 2016
tarafından
Lobsiinvok
Kaydeden (comit)
Joffrey F
Ock 20, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add filters option to NetworkApiMixin.networks
Signed-off-by:
Boik
<
qazbnm456@gmail.com
>
üst
206c1840
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
network.py
docker/api/network.py
+10
-7
No files found.
docker/api/network.py
Dosyayı görüntüle @
17c6e05e
import
json
from
..errors
import
InvalidVersion
from
..utils
import
check_resource
,
minimum_version
from
..utils
import
version_lt
from
..
import
utils
class
NetworkApiMixin
(
object
):
@minimum_version
(
'1.21'
)
def
networks
(
self
,
names
=
None
,
ids
=
None
):
def
networks
(
self
,
names
=
None
,
ids
=
None
,
filters
=
None
):
"""
List networks. Similar to the ``docker networks ls`` command.
Args:
names (list): List of names to filter by
ids (list): List of ids to filter by
filters (dict): Filters to be processed on the network list.
Available filters:
- ``driver=[<driver-name>]`` Matches a network's driver.
- ``label=[<key>]`` or ``label=[<key>=<value>]``.
- ``type=["custom"|"builtin"] `` Filters networks by type.
Returns:
(dict): List of network objects.
...
...
@@ -23,14 +27,13 @@ class NetworkApiMixin(object):
If the server returns an error.
"""
filters
=
{}
if
filters
is
None
:
filters
=
{}
if
names
:
filters
[
'name'
]
=
names
if
ids
:
filters
[
'id'
]
=
ids
params
=
{
'filters'
:
json
.
dumps
(
filters
)}
params
=
{
'filters'
:
utils
.
convert_filters
(
filters
)}
url
=
self
.
_url
(
"/networks"
)
res
=
self
.
_get
(
url
,
params
=
params
)
return
self
.
_result
(
res
,
json
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment