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


Golang NetworkPolicy.GetUuid方法代码示例

本文整理汇总了Golang中github.com/Juniper/contrail-go-api/types.NetworkPolicy.GetUuid方法的典型用法代码示例。如果您正苦于以下问题:Golang NetworkPolicy.GetUuid方法的具体用法?Golang NetworkPolicy.GetUuid怎么用?Golang NetworkPolicy.GetUuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/Juniper/contrail-go-api/types.NetworkPolicy的用法示例。


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

示例1: disconnectNetworkFromPolicy

func (m *NetworkManagerImpl) disconnectNetworkFromPolicy(policy *types.NetworkPolicy, targetCSN string) error {
	target, err := types.VirtualNetworkByName(m.client, targetCSN)
	if err != nil {
		return err
	}
	err = target.DeleteNetworkPolicy(policy.GetUuid())
	if err != nil {
		return err
	}
	return m.client.Update(target)
}
开发者ID:pupapaik,项目名称:contrail-kubernetes,代码行数:11,代码来源:network.go

示例2: policyAttach

func policyAttach(client contrail.ApiClient, network *types.VirtualNetwork, policy *types.NetworkPolicy) error {
	refs, err := network.GetNetworkPolicyRefs()
	if err != nil {
		glog.Errorf("get network policy-refs %s: %v", network.GetName(), err)
		return err
	}
	for _, ref := range refs {
		if ref.Uuid == policy.GetUuid() {
			return nil
		}
	}
	network.AddNetworkPolicy(policy,
		types.VirtualNetworkPolicyType{
			Sequence: &types.SequenceType{Major: 10, Minor: 0},
		})
	err = client.Update(network)
	if err != nil {
		glog.Errorf("Update network %s policies: %v", network.GetName(), err)
		return err
	}
	return nil
}
开发者ID:pupapaik,项目名称:contrail-kubernetes,代码行数:22,代码来源:policy.go

示例3: attachPolicy

func (m *ServiceManagerImpl) attachPolicy(network *types.VirtualNetwork, policy *types.NetworkPolicy) error {
	refs, err := network.GetNetworkPolicyRefs()
	if err != nil {
		glog.Errorf("get network policy-refs %s: %v", network.GetName(), err)
		return err
	}
	for _, ref := range refs {
		if ref.Uuid == policy.GetUuid() {
			return nil
		}
	}
	network.AddNetworkPolicy(policy,
		types.VirtualNetworkPolicyType{
			Sequence: &types.SequenceType{10, 0},
		})
	err = m.client.Update(network)
	if err != nil {
		glog.Errorf("Update network %s policies: %v", network.GetName(), err)
		return err
	}
	return nil
}
开发者ID:ZJU-SEL,项目名称:contrail-kubernetes,代码行数:22,代码来源:service.go


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