本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例9: CheckChanges
func (_ *SecurityGroupRule) CheckChanges(a, e, changes *SecurityGroupRule) error {
if a == nil {
if e.SecurityGroup == nil {
return fi.RequiredField("SecurityGroup")
}
}
return nil
}
示例10: CheckChanges
func (_ *Instance) CheckChanges(a, e, changes *Instance) error {
if a != nil {
if e.Name == nil {
return fi.RequiredField("Name")
}
}
return nil
}
示例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
}
示例12: CheckChanges
func (s *AutoscalingGroup) CheckChanges(a, e, changes *AutoscalingGroup) error {
if a != nil {
if e.Name == nil {
return fi.RequiredField("Name")
}
}
return nil
}
示例13: CheckChanges
func (s *IAMRolePolicy) CheckChanges(a, e, changes *IAMRolePolicy) error {
if a != nil {
if e.Name == nil {
return fi.RequiredField("Name")
}
}
return nil
}
示例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
}
示例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
}