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

     1  package gcp
     2  
     3  import "github.com/openshift/installer/pkg/types/gcp"
     4  
     5  // cloudResource hold various fields for any given cloud resource
     6  type cloudResource struct {
     7  	key      string
     8  	name     string
     9  	project  string
    10  	status   string
    11  	typeName string
    12  	url      string
    13  	zone     string
    14  	quota    []gcp.QuotaUsage
    15  }
    16  
    17  type cloudResources map[string]cloudResource
    18  
    19  func (r cloudResources) insert(resources ...cloudResource) cloudResources {
    20  	for _, resource := range resources {
    21  		r[resource.key] = resource
    22  	}
    23  	return r
    24  }
    25  
    26  func (r cloudResources) delete(resources ...cloudResource) cloudResources {
    27  	for _, resource := range resources {
    28  		delete(r, resource.key)
    29  	}
    30  	return r
    31  }
    32  
    33  func (r cloudResources) list() []cloudResource {
    34  	values := []cloudResource{}
    35  	for _, value := range r {
    36  		values = append(values, value)
    37  	}
    38  	return values
    39  }