當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。