github.com/openshift/installer@v1.4.17/pkg/destroy/gcp/quota.go (about)

     1  package gcp
     2  
     3  import "github.com/openshift/installer/pkg/types/gcp"
     4  
     5  // mergeAllUsage merges the update into the usage we know about, matching on metrics
     6  func mergeAllUsage(into []gcp.QuotaUsage, update []gcp.QuotaUsage) []gcp.QuotaUsage {
     7  	for _, item := range update {
     8  		updated := false
     9  		for i := range into {
    10  			if into[i].Metric.Matches(item.Metric) {
    11  				into[i].Amount += item.Amount
    12  				updated = true
    13  			}
    14  		}
    15  		if !updated {
    16  			into = append(into, item)
    17  		}
    18  	}
    19  	return into
    20  }