MCPcopy Index your code
hub / github.com/docker/docker-py / PluginCollection

Class PluginCollection

docker/models/plugins.py:131–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129
130
131class PluginCollection(Collection):
132 model = Plugin
133
134 def create(self, name, plugin_data_dir, gzip=False):
135 """
136 Create a new plugin.
137
138 Args:
139 name (string): The name of the plugin. The ``:latest`` tag is
140 optional, and is the default if omitted.
141 plugin_data_dir (string): Path to the plugin data directory.
142 Plugin data directory must contain the ``config.json``
143 manifest file and the ``rootfs`` directory.
144 gzip (bool): Compress the context using gzip. Default: False
145
146 Returns:
147 (:py:class:`Plugin`): The newly created plugin.
148 """
149 self.client.api.create_plugin(name, plugin_data_dir, gzip)
150 return self.get(name)
151
152 def get(self, name):
153 """
154 Gets a plugin.
155
156 Args:
157 name (str): The name of the plugin.
158
159 Returns:
160 (:py:class:`Plugin`): The plugin.
161
162 Raises:
163 :py:class:`docker.errors.NotFound` If the plugin does not
164 exist.
165 :py:class:`docker.errors.APIError`
166 If the server returns an error.
167 """
168 return self.prepare_model(self.client.api.inspect_plugin(name))
169
170 def install(self, remote_name, local_name=None):
171 """
172 Pull and install a plugin.
173
174 Args:
175 remote_name (string): Remote reference for the plugin to
176 install. The ``:latest`` tag is optional, and is the
177 default if omitted.
178 local_name (string): Local name for the pulled plugin.
179 The ``:latest`` tag is optional, and is the default if
180 omitted. Optional.
181
182 Returns:
183 (:py:class:`Plugin`): The installed plugin
184 Raises:
185 :py:class:`docker.errors.APIError`
186 If the server returns an error.
187 """
188 privileges = self.client.api.plugin_privileges(remote_name)

Callers 1

pluginsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected