func()

in pkg/firebase/apphostingschema/apphostingschema.go [123:158]


func (rc *RunConfig) UnmarshalYAML(unmarshal func(any) error) error {
	type plain RunConfig // Define an alias
	if err := unmarshal((*plain)(rc)); err != nil {
		return err
	}

	// Validation for 'CPU'
	if rc.CPU != nil && !(1 <= *rc.CPU && *rc.CPU <= 8) {
		return fmt.Errorf("runConfig.cpu field is not in valid range of [1, 8]")
	}

	// Validation for 'MemoryMiB'
	if rc.MemoryMiB != nil && !(512 <= *rc.MemoryMiB && *rc.MemoryMiB <= 32768) {
		return fmt.Errorf("runConfig.memory field is not in valid range of [512, 32768]")
	}

	// Validation for 'Concurrency'
	if rc.Concurrency != nil && !(1 <= *rc.Concurrency && *rc.Concurrency <= 1000) {
		return fmt.Errorf("runConfig.concurrency field is not in valid range of [1, 1000]")
	}

	// Validation for 'MaxInstances'
	if rc.MaxInstances != nil && !(1 <= *rc.MaxInstances && *rc.MaxInstances <= 100) {
		return fmt.Errorf("runConfig.maxInstances field is not in valid range of [1, 100]")
	}

	// Validation for 'minInstances'
	if rc.MinInstances != nil && !(0 <= *rc.MinInstances && *rc.MinInstances <= 100) {
		return fmt.Errorf("runConfig.minInstances field is not in valid range of [1, 100]")
	}

	if err := ValidateVpcAccess(rc.VpcAccess); err != nil {
		return err
	}
	return nil
}