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


Golang fi.RequiredField函數代碼示例

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


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

示例1: CheckChanges

func (s *Route) CheckChanges(a, e, changes *Route) error {
	if a == nil {
		// TODO: Create validate method?
		if e.RouteTable == nil {
			return fi.RequiredField("RouteTable")
		}
		if e.CIDR == nil {
			return fi.RequiredField("CIDR")
		}
		targetCount := 0
		if e.InternetGateway != nil {
			targetCount++
		}
		if e.Instance != nil {
			targetCount++
		}
		if targetCount == 0 {
			return fmt.Errorf("InternetGateway or Instance is required")
		}
		if targetCount != 1 {
			return fmt.Errorf("Cannot set both InternetGateway and Instance")
		}
	}

	if a != nil {
		if changes.RouteTable != nil {
			return fi.CannotChangeField("RouteTable")
		}
		if changes.CIDR != nil {
			return fi.CannotChangeField("CIDR")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:34,代碼來源:route.go

示例2: CheckChanges

func (s *Subnet) CheckChanges(a, e, changes *Subnet) error {
	if a == nil {
		if e.VPC == nil {
			return fi.RequiredField("VPC")
		}

		if e.CIDR == nil {
			// TODO: Auto-assign CIDR?
			return fi.RequiredField("CIDR")
		}
	}

	if a != nil {
		if changes.VPC != nil {
			// TODO: Do we want to destroy & recreate the subnet?
			return fi.CannotChangeField("VPC")
		}
		if changes.AvailabilityZone != nil {
			// TODO: Do we want to destroy & recreate the subnet?
			return fi.CannotChangeField("AvailabilityZone")
		}
		if changes.CIDR != nil {
			// TODO: Do we want to destroy & recreate the subnet?
			return fi.CannotChangeField("CIDR")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:28,代碼來源:subnet.go

示例3: CheckChanges

func (s *LoadBalancerHealthChecks) CheckChanges(a, e, changes *LoadBalancerHealthChecks) error {
	if a == nil {
		if e.LoadBalancer == nil {
			return fi.RequiredField("LoadBalancer")
		}
		if e.Target == nil {
			return fi.RequiredField("Target")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:11,代碼來源:loadbalancer_healthchecks.go

示例4: CheckChanges

func (s *LoadBalancerAttachment) CheckChanges(a, e, changes *LoadBalancerAttachment) error {
	if a == nil {
		if e.LoadBalancer == nil {
			return fi.RequiredField("LoadBalancer")
		}
		if e.AutoscalingGroup == nil {
			return fi.RequiredField("AutoscalingGroup")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:11,代碼來源:load_balancer_attachment.go

示例5: CheckChanges

func (s *IAMInstanceProfileRole) CheckChanges(a, e, changes *IAMInstanceProfileRole) error {
	if a != nil {
		if e.Role == nil {
			return fi.RequiredField("Role")
		}
		if e.InstanceProfile == nil {
			return fi.RequiredField("InstanceProfile")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:11,代碼來源:iaminstanceprofilerole.go

示例6: CheckChanges

func (s *LoadBalancer) CheckChanges(a, e, changes *LoadBalancer) error {
	if a == nil {
		if fi.StringValue(e.Name) == "" {
			return fi.RequiredField("Name")
		}
		if len(e.SecurityGroups) == 0 {
			return fi.RequiredField("SecurityGroups")
		}
		if len(e.Subnets) == 0 {
			return fi.RequiredField("Subnets")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:14,代碼來源:load_balancer.go

示例7: CheckChanges

func (s *LaunchConfiguration) CheckChanges(a, e, changes *LaunchConfiguration) error {
	if e.ImageID == nil {
		return fi.RequiredField("ImageID")
	}
	if e.InstanceType == nil {
		return fi.RequiredField("InstanceType")
	}

	if a != nil {
		if e.Name == nil {
			return fi.RequiredField("Name")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:15,代碼來源:launchconfiguration.go

示例8: CheckChanges

func (s *IAMInstanceProfile) CheckChanges(a, e, changes *IAMInstanceProfile) error {
	if a != nil {
		if fi.StringValue(e.Name) == "" {
			return fi.RequiredField("Name")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:iaminstanceprofile.go

示例9: CheckChanges

func (_ *SecurityGroupRule) CheckChanges(a, e, changes *SecurityGroupRule) error {
	if a == nil {
		if e.SecurityGroup == nil {
			return fi.RequiredField("SecurityGroup")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:securitygrouprule.go

示例10: CheckChanges

func (_ *Instance) CheckChanges(a, e, changes *Instance) error {
	if a != nil {
		if e.Name == nil {
			return fi.RequiredField("Name")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:instance.go

示例11: CheckChanges

func (s *VPCDHCPOptionsAssociation) CheckChanges(a, e, changes *VPCDHCPOptionsAssociation) error {
	if e.VPC == nil {
		return fi.RequiredField("VPC")
	}
	if e.DHCPOptions == nil {
		return fi.RequiredField("DHCPOptions")
	}

	if a != nil && changes != nil {
		if changes.VPC != nil {
			// Should be impossible anyway because VPC is our primary key...
			return fi.CannotChangeField("VPC")
		}
	}

	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:17,代碼來源:vpc_dhcpoptions_association.go

示例12: CheckChanges

func (s *AutoscalingGroup) CheckChanges(a, e, changes *AutoscalingGroup) error {
	if a != nil {
		if e.Name == nil {
			return fi.RequiredField("Name")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:autoscalinggroup.go

示例13: CheckChanges

func (s *IAMRolePolicy) CheckChanges(a, e, changes *IAMRolePolicy) error {
	if a != nil {
		if e.Name == nil {
			return fi.RequiredField("Name")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:iamrolepolicy.go

示例14: CheckChanges

func (s *DNSName) CheckChanges(a, e, changes *DNSName) error {
	if a == nil {
		if fi.StringValue(e.Name) == "" {
			return fi.RequiredField("Name")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:8,代碼來源:dnsname.go

示例15: CheckChanges

func (s *RouteTableAssociation) CheckChanges(a, e, changes *RouteTableAssociation) error {
	if a != nil {
		if e.RouteTable == nil {
			return fi.RequiredField("RouteTable")
		}
		if e.Subnet == nil {
			return fi.RequiredField("Subnet")
		}
	}
	if a != nil {
		if changes.RouteTable != nil {
			return fi.CannotChangeField("RouteTable")
		}
		if changes.Subnet != nil {
			return fi.CannotChangeField("Subnet")
		}
	}
	return nil
}
開發者ID:crohling,項目名稱:kops,代碼行數:19,代碼來源:routetableassociation.go


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