func determineParams()

in custom-targets/vertex-ai/model-deployer/request.go [99:132]


func determineParams() (*params, error) {

	replicaCount, err := strconv.Atoi(os.Getenv(minReplicaCountEnvKey))
	if err != nil {
		replicaCount = 0
	}

	model, found := os.LookupEnv(modelEnvKey)
	if !found {
		fmt.Printf("Required environment variable %s not found. This variable is derived from deploy parameter: %s, please verify that a valid Vertex AI model resource name was provided through this deploy parameter.\n", modelEnvKey, modelDPKey)
		return nil, fmt.Errorf("required environment variable %s not found", modelEnvKey)
	}
	if model == "" {
		fmt.Printf("environment variable %s is empty. This variable is derived from deploy parameter: %s, please verify that a valid Vertex AI model resource name was provided through this deploy parameter.\n", modelEnvKey, modelDPKey)
		return nil, fmt.Errorf("environment variable %s contains empty string", modelEnvKey)
	}

	endpoint, found := os.LookupEnv(endpointEnvKey)
	if !found {
		fmt.Printf("Required environment variable %s not found. This variable is derived from deploy parameter: %s, please verify that a valid Vertex AI model resource name was provided through this deploy parameter.\n", endpointEnvKey, endpointDPKey)
		return nil, fmt.Errorf("required environment variable %s not found", modelEnvKey)
	}
	if model == "" {
		fmt.Printf("environment variable %s is empty. This variable is derived from deploy parameter: %s, please verify that a valid Vertex AI model resource name was provided through this deploy parameter.\n", endpointEnvKey, endpointDPKey)
		return nil, fmt.Errorf("environment variable %s contains empty string", modelEnvKey)
	}

	return &params{
		model:           model,
		endpoint:        endpoint,
		minReplicaCount: int64(replicaCount),
		configPath:      os.Getenv(configPathKey),
	}, nil
}