當前位置: 首頁>>代碼示例>>Golang>>正文


Golang PluginGetter.Get方法代碼示例

本文整理匯總了Golang中github.com/docker/docker/pkg/plugingetter.PluginGetter.Get方法的典型用法代碼示例。如果您正苦於以下問題:Golang PluginGetter.Get方法的具體用法?Golang PluginGetter.Get怎麽用?Golang PluginGetter.Get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/docker/docker/pkg/plugingetter.PluginGetter的用法示例。


在下文中一共展示了PluginGetter.Get方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: lookupPlugin

func lookupPlugin(name, home string, opts []string, pg plugingetter.PluginGetter) (Driver, error) {
	pl, err := pg.Get(name, "GraphDriver", plugingetter.LOOKUP)
	if err != nil {
		return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err)
	}
	return newPluginDriver(name, home, opts, pl.Client())
}
開發者ID:Mic92,項目名稱:docker,代碼行數:7,代碼來源:plugin.go

示例2: validateDriver

func validateDriver(driver *api.Driver, pg plugingetter.PluginGetter, pluginType string) error {
	if driver == nil {
		// It is ok to not specify the driver. We will choose
		// a default driver.
		return nil
	}

	if driver.Name == "" {
		return grpc.Errorf(codes.InvalidArgument, "driver name: if driver is specified name is required")
	}

	if strings.ToLower(driver.Name) == networkallocator.DefaultDriver || strings.ToLower(driver.Name) == ipamapi.DefaultIPAM {
		return nil
	}

	p, err := pg.Get(driver.Name, pluginType, plugingetter.Lookup)
	if err != nil {
		return grpc.Errorf(codes.InvalidArgument, "error during lookup of plugin %s", driver.Name)
	}

	if p.IsV1() {
		return grpc.Errorf(codes.InvalidArgument, "legacy plugin %s of type %s is not supported in swarm mode", driver.Name, pluginType)
	}

	return nil
}
開發者ID:yongtang,項目名稱:swarmkit,代碼行數:26,代碼來源:common.go

示例3: validateAuthzPlugins

// validates that the plugins requested with the --authorization-plugin flag are valid AuthzDriver
// plugins present on the host and available to the daemon
func validateAuthzPlugins(requestedPlugins []string, pg plugingetter.PluginGetter) error {
	for _, reqPlugin := range requestedPlugins {
		if _, err := pg.Get(reqPlugin, authorization.AuthZApiImplements, plugingetter.LOOKUP); err != nil {
			return err
		}
	}
	return nil
}
開發者ID:mYmNeo,項目名稱:docker,代碼行數:10,代碼來源:daemon.go

示例4: lookupPlugin

func lookupPlugin(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) {
	if !config.ExperimentalEnabled {
		return nil, fmt.Errorf("graphdriver plugins are only supported with experimental mode")
	}
	pl, err := pg.Get(name, "GraphDriver", plugingetter.Acquire)
	if err != nil {
		return nil, fmt.Errorf("Error looking up graphdriver plugin %s: %v", name, err)
	}
	return newPluginDriver(name, pl, config)
}
開發者ID:docker,項目名稱:docker,代碼行數:10,代碼來源:plugin.go


注:本文中的github.com/docker/docker/pkg/plugingetter.PluginGetter.Get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。