当前位置: 首页>>代码示例>>Golang>>正文


Golang Config.EnableSwaggerSupport方法代码示例

本文整理汇总了Golang中k8s/io/kubernetes/pkg/master.Config.EnableSwaggerSupport方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.EnableSwaggerSupport方法的具体用法?Golang Config.EnableSwaggerSupport怎么用?Golang Config.EnableSwaggerSupport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在k8s/io/kubernetes/pkg/master.Config的用法示例。


在下文中一共展示了Config.EnableSwaggerSupport方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: startMasterOrDie

// startMasterOrDie starts a kubernetes master and an httpserver to handle api requests
func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Server) {
	var m *master.Master
	s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		m.Handler.ServeHTTP(w, req)
	}))

	if masterConfig == nil {
		masterConfig = NewMasterConfig()
		masterConfig.EnableProfiling = true
		masterConfig.EnableSwaggerSupport = true
		masterConfig.EnableOpenAPISupport = true
		masterConfig.OpenAPIInfo = spec.Info{
			InfoProps: spec.InfoProps{
				Title:   "Kubernetes",
				Version: "unversioned",
			},
		}
		masterConfig.OpenAPIDefaultResponse = spec.Response{
			ResponseProps: spec.ResponseProps{
				Description: "Default Response.",
			},
		}
	}
	m, err := master.New(masterConfig)
	if err != nil {
		glog.Fatalf("error in bringing up the master: %v", err)
	}

	return m, s
}
开发者ID:juanluisvaladas,项目名称:origin,代码行数:31,代码来源:master_utils.go

示例2: startMasterOrDie

// startMasterOrDie starts a kubernetes master and an httpserver to handle api requests
func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Server) {
	var m *master.Master
	s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		m.Handler.ServeHTTP(w, req)
	}))

	if masterConfig == nil {
		masterConfig = NewMasterConfig()
		masterConfig.EnableProfiling = true
		masterConfig.EnableSwaggerSupport = true
		masterConfig.EnableOpenAPISupport = true
		masterConfig.OpenAPIInfo = spec.Info{
			InfoProps: spec.InfoProps{
				Title:   "Kubernetes",
				Version: "unversioned",
			},
		}
		masterConfig.OpenAPIDefaultResponse = spec.Response{
			ResponseProps: spec.ResponseProps{
				Description: "Default Response.",
			},
		}
	}
	m, err := master.New(masterConfig)
	if err != nil {
		glog.Fatalf("error in bringing up the master: %v", err)
	}

	// TODO have this start method actually use the normal start sequence for the API server
	// this method never actually calls the `Run` method for the API server
	// fire the post hooks ourselves
	m.GenericAPIServer.RunPostStartHooks(genericapiserver.PostStartHookContext{})

	return m, s
}
开发者ID:aishraj,项目名称:kubernetes,代码行数:36,代码来源:master_utils.go

示例3: startMasterOrDie

// startMasterOrDie starts a kubernetes master and an httpserver to handle api requests
func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Server) {
	var m *master.Master
	s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		m.Handler.ServeHTTP(w, req)
	}))

	if masterConfig == nil {
		masterConfig = NewMasterConfig()
		masterConfig.EnableProfiling = true
		masterConfig.EnableSwaggerSupport = true
	}
	m = master.New(masterConfig)
	return m, s
}
开发者ID:adamsondelacruz,项目名称:kubernetes,代码行数:15,代码来源:master_utils.go

示例4: startMasterOrDie

// startMasterOrDie starts a kubernetes master and an httpserver to handle api requests
func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Server) {
	var m *master.Master
	s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
		m.Handler.ServeHTTP(w, req)
	}))

	if masterConfig == nil {
		masterConfig = NewMasterConfig()
		masterConfig.EnableProfiling = true
		masterConfig.EnableSwaggerSupport = true
	}
	m, err := master.New(masterConfig)
	if err != nil {
		glog.Fatalf("error in bringing up the master: %v", err)
	}

	return m, s
}
开发者ID:ethernetdan,项目名称:kubernetes,代码行数:19,代码来源:master_utils.go


注:本文中的k8s/io/kubernetes/pkg/master.Config.EnableSwaggerSupport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。