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


Golang etcd.InterpretCreateError函數代碼示例

本文整理匯總了Golang中github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors/etcd.InterpretCreateError函數的典型用法代碼示例。如果您正苦於以下問題:Golang InterpretCreateError函數的具體用法?Golang InterpretCreateError怎麽用?Golang InterpretCreateError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: CreateBuild

// CreateBuild creates a new Build.
func (r *Etcd) CreateBuild(ctx kapi.Context, build *api.Build) error {
	key, err := makeBuildKey(ctx, build.Name)
	if err != nil {
		return err
	}
	err = r.CreateObj(key, build, nil, 0)
	return etcderr.InterpretCreateError(err, "build", build.Name)
}
開發者ID:pombredanne,項目名稱:atomic-enterprise,代碼行數:9,代碼來源:etcd.go

示例2: CreateBuildConfig

// CreateBuildConfig creates a new BuildConfig.
func (r *Etcd) CreateBuildConfig(ctx kapi.Context, config *api.BuildConfig) error {
	key, err := makeBuildConfigKey(ctx, config.Name)
	if err != nil {
		return err
	}
	err = r.CreateObj(key, config, nil, 0)
	return etcderr.InterpretCreateError(err, "buildConfig", config.Name)
}
開發者ID:pombredanne,項目名稱:atomic-enterprise,代碼行數:9,代碼來源:etcd.go

示例3: CreateController

// CreateController creates a new ReplicationController.
func (r *Registry) CreateController(ctx api.Context, controller *api.ReplicationController) error {
	key, err := makeControllerKey(ctx, controller.Name)
	if err != nil {
		return err
	}
	err = r.CreateObj(key, controller, 0)
	return etcderr.InterpretCreateError(err, "replicationController", controller.Name)
}
開發者ID:hortonworks,項目名稱:kubernetes-yarn,代碼行數:9,代碼來源:etcd.go

示例4: CreateService

// CreateService creates a new Service.
func (r *Registry) CreateService(ctx api.Context, svc *api.Service) error {
	key, err := makeServiceKey(ctx, svc.Name)
	if err != nil {
		return err
	}
	err = r.CreateObj(key, svc, 0)
	return etcderr.InterpretCreateError(err, "service", svc.Name)
}
開發者ID:hortonworks,項目名稱:kubernetes-yarn,代碼行數:9,代碼來源:etcd.go

示例5: Create

// Create stores the object with a ttl, so that events don't stay in the system forever.
func (r registry) Create(ctx api.Context, id string, obj runtime.Object) error {
	key, err := r.Etcd.KeyFunc(ctx, id)
	if err != nil {
		return err
	}
	err = r.Etcd.Helper.CreateObj(key, obj, r.ttl)
	return etcderr.InterpretCreateError(err, r.Etcd.EndpointName, id)
}
開發者ID:hortonworks,項目名稱:kubernetes-yarn,代碼行數:9,代碼來源:registry.go

示例6: Create

// Create inserts a new item.
func (e *Etcd) Create(ctx api.Context, id string, obj runtime.Object) error {
	key, err := e.KeyFunc(ctx, id)
	if err != nil {
		return err
	}
	err = e.Helper.CreateObj(key, obj, 0)
	return etcderr.InterpretCreateError(err, e.EndpointName, id)
}
開發者ID:hortonworks,項目名稱:kubernetes-yarn,代碼行數:9,代碼來源:etcd.go

示例7: CreateRoute

// CreateRoute creates a new Route.
func (registry *Etcd) CreateRoute(ctx kapi.Context, route *api.Route) error {
	key, err := makeRouteKey(ctx, route.Name)
	if err != nil {
		return err
	}
	err = registry.Create(key, route, nil, 0)
	return etcderr.InterpretCreateError(err, "route", route.Name)
}
開發者ID:dustintownsend,項目名稱:origin,代碼行數:9,代碼來源:etcd.go

示例8: CreateController

// CreateController creates a new ReplicationController.
func (r *Registry) CreateController(ctx api.Context, controller *api.ReplicationController) (*api.ReplicationController, error) {
	key, err := makeControllerKey(ctx, controller.Name)
	if err != nil {
		return nil, err
	}
	out := &api.ReplicationController{}
	err = r.CreateObj(key, controller, out, 0)
	return out, etcderr.InterpretCreateError(err, "replicationController", controller.Name)
}
開發者ID:SivagnanamCiena,項目名稱:calico-kubernetes,代碼行數:10,代碼來源:etcd.go

示例9: CreateService

// CreateService creates a new Service.
func (r *Registry) CreateService(ctx api.Context, svc *api.Service) (*api.Service, error) {
	key, err := makeServiceKey(ctx, svc.Name)
	if err != nil {
		return nil, err
	}
	out := &api.Service{}
	err = r.CreateObj(key, svc, out, 0)
	return out, etcderr.InterpretCreateError(err, "service", svc.Name)
}
開發者ID:SivagnanamCiena,項目名稱:calico-kubernetes,代碼行數:10,代碼來源:etcd.go

示例10: CreatePod

// CreatePod creates a pod based on a specification.
func (r *Registry) CreatePod(pod *api.Pod) error {
	// Set current status to "Waiting".
	pod.CurrentState.Status = api.PodWaiting
	pod.CurrentState.Host = ""
	// DesiredState.Host == "" is a signal to the scheduler that this pod needs scheduling.
	pod.DesiredState.Status = api.PodRunning
	pod.DesiredState.Host = ""
	err := r.CreateObj(makePodKey(pod.ID), pod)
	return etcderr.InterpretCreateError(err, "pod", pod.ID)
}
開發者ID:linuxwhy,項目名稱:kubernetes,代碼行數:11,代碼來源:etcd.go

示例11: CreatePod

// CreatePod creates a pod based on a specification.
func (r *Registry) CreatePod(ctx api.Context, pod *api.Pod) error {
	// Set current status to "Waiting".
	pod.Status.Phase = api.PodPending
	pod.Status.Host = ""
	key, err := makePodKey(ctx, pod.Name)
	if err != nil {
		return err
	}
	err = r.CreateObj(key, pod, 0)
	return etcderr.InterpretCreateError(err, "pod", pod.Name)
}
開發者ID:hortonworks,項目名稱:kubernetes-yarn,代碼行數:12,代碼來源:etcd.go

示例12: CreatePod

// CreatePod creates a pod based on a specification.
func (r *Registry) CreatePod(ctx api.Context, pod *api.Pod) error {
	// Set current status to "Waiting".
	pod.CurrentState.Status = api.PodPending
	pod.CurrentState.Host = ""
	// DesiredState.Host == "" is a signal to the scheduler that this pod needs scheduling.
	pod.DesiredState.Status = api.PodRunning
	pod.DesiredState.Host = ""
	key, err := makePodKey(ctx, pod.Name)
	if err != nil {
		return err
	}
	err = r.CreateObj(key, pod, 0)
	return etcderr.InterpretCreateError(err, "pod", pod.Name)
}
開發者ID:ericcapricorn,項目名稱:kubernetes,代碼行數:15,代碼來源:etcd.go

示例13: Create

// Create inserts a new item according to the unique key from the object.
func (e *Etcd) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error) {
	trace := util.NewTrace("Create")
	defer trace.LogIfLong(time.Second)
	if err := rest.BeforeCreate(e.CreateStrategy, ctx, obj); err != nil {
		return nil, err
	}
	name, err := e.ObjectNameFunc(obj)
	if err != nil {
		return nil, err
	}
	key, err := e.KeyFunc(ctx, name)
	if err != nil {
		return nil, err
	}
	ttl := uint64(0)
	if e.TTLFunc != nil {
		ttl, err = e.TTLFunc(obj, false)
		if err != nil {
			return nil, err
		}
	}
	trace.Step("About to create object")
	out := e.NewFunc()
	if err := e.Helper.CreateObj(key, obj, out, ttl); err != nil {
		err = etcderr.InterpretCreateError(err, e.EndpointName, name)
		err = rest.CheckGeneratedNameError(e.CreateStrategy, err, obj)
		return nil, err
	}
	trace.Step("Object created")
	if e.AfterCreate != nil {
		if err := e.AfterCreate(out); err != nil {
			return nil, err
		}
	}
	if e.Decorator != nil {
		if err := e.Decorator(obj); err != nil {
			return nil, err
		}
	}
	return out, nil
}
開發者ID:cjnygard,項目名稱:origin,代碼行數:42,代碼來源:etcd.go

示例14: CreateWithName

// CreateWithName inserts a new item with the provided name
// DEPRECATED: use Create instead
func (e *Etcd) CreateWithName(ctx api.Context, name string, obj runtime.Object) error {
	key, err := e.KeyFunc(ctx, name)
	if err != nil {
		return err
	}
	if e.CreateStrategy != nil {
		if err := rest.BeforeCreate(e.CreateStrategy, ctx, obj); err != nil {
			return err
		}
	}
	ttl, err := e.calculateTTL(obj, 0, false)
	if err != nil {
		return err
	}
	err = e.Helper.CreateObj(key, obj, nil, ttl)
	err = etcderr.InterpretCreateError(err, e.EndpointName, name)
	if err == nil && e.Decorator != nil {
		err = e.Decorator(obj)
	}
	return err
}
開發者ID:brandon-adams,項目名稱:origin,代碼行數:23,代碼來源:etcd.go

示例15: Create

// Create inserts a new item according to the unique key from the object.
func (e *Etcd) Create(ctx api.Context, obj runtime.Object) (runtime.Object, error) {
	if err := rest.BeforeCreate(e.CreateStrategy, ctx, obj); err != nil {
		return nil, err
	}
	name, err := e.ObjectNameFunc(obj)
	if err != nil {
		return nil, err
	}
	key, err := e.KeyFunc(ctx, name)
	if err != nil {
		return nil, err
	}
	ttl := uint64(0)
	if e.TTLFunc != nil {
		ttl, err = e.TTLFunc(obj, false)
		if err != nil {
			return nil, err
		}
	}
	out := e.NewFunc()
	if err := e.Helper.CreateObj(key, obj, out, ttl); err != nil {
		err = etcderr.InterpretCreateError(err, e.EndpointName, name)
		err = rest.CheckGeneratedNameError(e.CreateStrategy, err, obj)
		return nil, err
	}
	if e.AfterCreate != nil {
		if err := e.AfterCreate(out); err != nil {
			return nil, err
		}
	}
	if e.Decorator != nil {
		if err := e.Decorator(obj); err != nil {
			return nil, err
		}
	}
	return out, nil
}
開發者ID:SivagnanamCiena,項目名稱:calico-kubernetes,代碼行數:38,代碼來源:etcd.go


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