You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: portal.go
    path of file: ./repos/nanobox/processors/platform
    
    the code of the file until where you have to start completion: package platform

import (
	"time"

	"github.com/jcelliott/lumber"

	"github.com/nanobox-io/golang-portal-client"
	generator "github.com/nanobox-io/nanobox/generators/router"
	"github.com/nanobox-io/nanobox/models"

    
func UpdatePortal(appModel *models.App) error {
	client := portalClient(appModel)

	// update routes
	routes := generator.BuildRoutes(appModel)
	updateRoute := func() error {
		return client.UpdateRoutes(routes)
	}

	// update cert
	certs, err := generator.BuildCert(appModel)
	if err != nil {
		return util.ErrorAppend(err, "failed to build cert")
	}

	updateCert := func() error {
		return client.UpdateCert(certs)
	}

	// use the retry method here because there is a chance the portal server isnt responding yet
	if err := util.Retry(updateRoute, 2, time.Second); err != nil {
		lumber.Error("platform:UpdatePortal:UpdateRoutes(%+v): %s", routes, err.Error())
		return util.ErrorAppend(err, "failed to send routing updates to the router")
	}

	// use the retry method here because there is a chance the portal server isnt responding yet
	if err := util.Retry(updateCert, 2, time.Second); err != nil {
		lumber.Error("platform:UpdatePortal:UpdateCerts(%+v): %s", certs, err.Error())
		return util.ErrorAppend(err, "failed to send cert updates to the router")
	}

	// update services
	services := generator.BuildServices(appModel)
	if err := client.UpdateServices(services); err != nil {
		lumber.Error("platform:UpdatePortal:UpdateServices(%+v): %s", services, err.Error())
		return util.ErrorAppend(err, "failed to update port forwarding")
	}

	return nil
}