• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang util.ModifyManifest函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/appc/acbuild/util.ModifyManifest函数的典型用法代码示例。如果您正苦于以下问题:Golang ModifyManifest函数的具体用法?Golang ModifyManifest怎么用?Golang ModifyManifest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: AddPort

// AddPort will add a port with the given name, protocol, port, and count to
// the untarred ACI stored at a.CurrentACIPath. If the port already exists its
// value will be updated to the new value. socketActivated signifies whether or
// not the application will be socket activated via this port.
func (a *ACBuild) AddPort(name, protocol string, port, count uint, socketActivated bool) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	acn, err := types.NewACName(name)
	if err != nil {
		return err
	}

	fn := func(s *schema.ImageManifest) error {
		if s.App == nil {
			s.App = newManifestApp()
		}
		removePort(*acn)(s)
		s.App.Ports = append(s.App.Ports,
			types.Port{
				Name:            *acn,
				Protocol:        protocol,
				Port:            port,
				Count:           count,
				SocketActivated: socketActivated,
			})
		return nil
	}
	return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:kinvolk,项目名称:acbuild,代码行数:36,代码来源:port.go


示例2: AddMount

// AddMount will add a mount point with the given name and path to the untarred
// ACI stored at a.CurrentACIPath. If the mount point already exists its value
// will be updated to the new value. readOnly signifies whether or not the
// mount point should be read only.
func (a *ACBuild) AddMount(name, path string, readOnly bool) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	acn, err := types.NewACName(name)
	if err != nil {
		return err
	}

	fn := func(s *schema.ImageManifest) error {
		removeMount(*acn)(s)
		if s.App == nil {
			s.App = newManifestApp()
		}
		s.App.MountPoints = append(s.App.MountPoints,
			types.MountPoint{
				Name:     *acn,
				Path:     path,
				ReadOnly: readOnly,
			})
		return nil
	}
	return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:kinvolk,项目名称:acbuild,代码行数:34,代码来源:mounts.go


示例3: AddIsolator

func (a *ACBuild) AddIsolator(name string, value []byte) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}
	rawMsg := json.RawMessage(value)

	fn := func(s *schema.ImageManifest) error {
		if s.App == nil {
			s.App = newManifestApp()
		}
		removeIsolatorFromMan(*acid)(s)
		s.App.Isolators = append(s.App.Isolators,
			types.Isolator{
				Name:     *acid,
				ValueRaw: &rawMsg,
			})
		return nil
	}
	return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:kinvolk,项目名称:acbuild,代码行数:30,代码来源:isolator.go


示例4: AddDependency

// AddDependency will add a dependency with the given name, id, labels, and size
// to the untarred ACI stored at acipath. If the dependency already exists its
// fields will be updated to the new values.
func AddDependency(acipath, imageName, imageId string, labels types.Labels, size uint) error {
	acid, err := types.NewACIdentifier(imageName)
	if err != nil {
		return err
	}

	var hash *types.Hash
	if imageId != "" {
		var err error
		hash, err = types.NewHash(imageId)
		if err != nil {
			return err
		}
	}

	fn := func(s *schema.ImageManifest) {
		removeDep(*acid)(s)
		s.Dependencies = append(s.Dependencies,
			types.Dependency{
				ImageName: *acid,
				ImageID:   hash,
				Labels:    labels,
				Size:      size,
			})
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:30,代码来源:dependencies.go


示例5: AddLabel

// AddLabel will add a label with the given name and value to the untarred ACI
// stored at a.CurrentACIPath. If the label already exists its value will be updated to
// the new value.
func (a *ACBuild) AddLabel(name, value string) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}

	fn := func(s *schema.ImageManifest) {
		removeLabelFromMan(*acid)(s)
		s.Labels = append(s.Labels,
			types.Label{
				Name:  *acid,
				Value: value,
			})
	}
	return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:aaronlevy,项目名称:acbuild,代码行数:28,代码来源:label.go


示例6: RemoveAnnotation

// RemoveAnnotation will remove the annotation with the given name from the
// untarred ACI stored at acipath
func RemoveAnnotation(acipath, name string) error {
	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}

	return util.ModifyManifest(removeAnnotation(*acid), acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:10,代码来源:annotations.go


示例7: RemoveMount

// RemoveMount will remove the mount point with the given name from the
// untarred ACI stored at acipath
func RemoveMount(acipath, name string) error {
	acn, err := types.NewACName(name)
	if err != nil {
		return err
	}

	return util.ModifyManifest(removeMount(*acn), acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:10,代码来源:mounts.go


示例8: RemoveDependency

// RemoveDependency will remove the dependency with the given name from the
// untarred ACI stored at acipath
func RemoveDependency(acipath, imageName string) error {
	acid, err := types.NewACIdentifier(imageName)
	if err != nil {
		return err
	}

	return util.ModifyManifest(removeDep(*acid), acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:10,代码来源:dependencies.go


示例9: AddEnv

// AddEnv will add an environment variable with the given name and value to the
// untarred ACI stored at acipath. If the environment variable already exists
// its value will be updated to the new value.
func AddEnv(acipath, name, value string) error {
	fn := func(s *schema.ImageManifest) {
		if s.App == nil {
			s.App = &types.App{}
		}
		s.App.Environment.Set(name, value)
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:12,代码来源:env.go


示例10: SetExec

// SetExec sets the exec command for the untarred ACI stored at acipath.
func SetExec(acipath string, cmd []string) error {
	fn := func(s *schema.ImageManifest) {
		if s.App == nil {
			s.App = &types.App{}
		}
		s.App.Exec = cmd
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:10,代码来源:set-exec.go


示例11: AddAnnotation

// AddAnnotation will add an annotation with the given name and value to the
// untarred ACI stored at acipath. If the annotation already exists its value
// will be updated to the new value.
func AddAnnotation(acipath, name, value string) error {
	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}

	fn := func(s *schema.ImageManifest) {
		s.Annotations.Set(*acid, value)
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:14,代码来源:annotations.go


示例12: RemoveEnv

// RemoveEnv will remove the environment variable with the given name from the
// untarred ACI stored at a.CurrentACIPath.
func (a *ACBuild) RemoveEnv(name string) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	return util.ModifyManifest(removeFromEnv(name), a.CurrentACIPath)
}
开发者ID:kinvolk,项目名称:acbuild,代码行数:14,代码来源:env.go


示例13: SetGroup

// SetGroup sets the group the pod will run as in the untarred ACI stored at
// acipath.
func SetGroup(acipath, group string) error {
	if group == "" {
		return fmt.Errorf("group cannot be empty")
	}
	fn := func(s *schema.ImageManifest) {
		if s.App == nil {
			s.App = &types.App{}
		}
		s.App.Group = group
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:14,代码来源:set-group.go


示例14: SetUser

// SetUser sets the user the pod will run as in the untarred ACI stored at
// acipath.
func SetUser(acipath, user string) error {
	if user == "" {
		return fmt.Errorf("user cannot be empty")
	}
	fn := func(s *schema.ImageManifest) {
		if s.App == nil {
			s.App = &types.App{}
		}
		s.App.User = user
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:14,代码来源:set-user.go


示例15: SetName

// SetName sets the name for the untarred ACI stored at acipath
func SetName(acipath, name string) error {
	if name == "" {
		return fmt.Errorf("name cannot be empty")
	}
	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}

	fn := func(s *schema.ImageManifest) {
		s.Name = *acid
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:15,代码来源:set-name.go


示例16: AddLabel

// AddLabel will add a label with the given name and value to the untarred ACI
// stored at acipath. If the label already exists its value will be updated to
// the new value.
func AddLabel(acipath, name, value string) error {
	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}

	fn := func(s *schema.ImageManifest) {
		removeLabelFromMan(*acid)(s)
		s.Labels = append(s.Labels,
			types.Label{
				Name:  *acid,
				Value: value,
			})
	}
	return util.ModifyManifest(fn, acipath)
}
开发者ID:jaypipes,项目名称:acbuild,代码行数:19,代码来源:label.go


示例17: RemoveAnnotation

// RemoveAnnotation will remove the annotation with the given name from the
// untarred ACI stored at a.CurrentACIPath
func (a *ACBuild) RemoveAnnotation(name string) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	acid, err := types.NewACIdentifier(name)
	if err != nil {
		return err
	}

	return util.ModifyManifest(removeAnnotation(*acid), a.CurrentACIPath)
}
开发者ID:aaronlevy,项目名称:acbuild,代码行数:19,代码来源:annotations.go


示例18: RemoveMount

// RemoveMount will remove the mount point with the given name from the
// untarred ACI stored at a.CurrentACIPath
func (a *ACBuild) RemoveMount(name string) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	acn, err := types.NewACName(name)
	if err != nil {
		return err
	}

	return util.ModifyManifest(removeMount(*acn), a.CurrentACIPath)
}
开发者ID:kinvolk,项目名称:acbuild,代码行数:19,代码来源:mounts.go


示例19: SetExec

// SetExec sets the exec command for the untarred ACI stored at
// a.CurrentACIPath.
func (a *ACBuild) SetExec(cmd []string) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	fn := func(s *schema.ImageManifest) {
		if s.App == nil {
			s.App = &types.App{}
		}
		s.App.Exec = cmd
	}
	return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:aaronlevy,项目名称:acbuild,代码行数:20,代码来源:set-exec.go


示例20: AddEnv

// AddEnv will add an environment variable with the given name and value to the
// untarred ACI stored at a.CurrentACIPath. If the environment variable already
// exists its value will be updated to the new value.
func (a *ACBuild) AddEnv(name, value string) (err error) {
	if err = a.lock(); err != nil {
		return err
	}
	defer func() {
		if err1 := a.unlock(); err == nil {
			err = err1
		}
	}()

	fn := func(s *schema.ImageManifest) {
		if s.App == nil {
			s.App = &types.App{}
		}
		s.App.Environment.Set(name, value)
	}
	return util.ModifyManifest(fn, a.CurrentACIPath)
}
开发者ID:aaronlevy,项目名称:acbuild,代码行数:21,代码来源:env.go



注:本文中的github.com/appc/acbuild/util.ModifyManifest函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang types.ACName类代码示例发布时间:2022-05-24
下一篇:
Golang util.GetManifest函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap