func()

in main/handlersettings.go [51:83]


func (h handlerSettings) validate() error {
	if h.commandToExecute() == "" && h.script() == "" {
		return errCmdMissing
	}
	if h.publicSettings.CommandToExecute != "" && h.protectedSettings.CommandToExecute != "" {
		return errCmdTooMany
	}

	if h.publicSettings.Script != "" && h.protectedSettings.Script != "" {
		return errScriptTooMany
	}

	if h.commandToExecute() != "" && h.script() != "" {
		return errCmdAndScript
	}

	if (h.protectedSettings.StorageAccountName != "") !=
		(h.protectedSettings.StorageAccountKey != "") {
		return errStoragePartialCredentials
	}

	if (h.protectedSettings.StorageAccountKey != "" || h.protectedSettings.StorageAccountName != "") && h.protectedSettings.ManagedIdentity != nil {
		return errUsingBothKeyAndMsi
	}

	if h.protectedSettings.ManagedIdentity != nil {
		if h.protectedSettings.ManagedIdentity.ClientId != "" && h.protectedSettings.ManagedIdentity.ObjectId != "" {
			return errUsingBothClientIdAndObjectId
		}
	}

	return nil
}