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

     1  package ibmcloud
     2  
     3  // cloudResource hold various fields for any given cloud resource
     4  type cloudResource struct {
     5  	key      string
     6  	name     string
     7  	status   string
     8  	typeName string
     9  	id       string
    10  }
    11  
    12  type cloudResources map[string]cloudResource
    13  
    14  func (r cloudResources) insert(resources ...cloudResource) cloudResources {
    15  	for _, resource := range resources {
    16  		r[resource.key] = resource
    17  	}
    18  	return r
    19  }
    20  
    21  func (r cloudResources) delete(resources ...cloudResource) cloudResources {
    22  	for _, resource := range resources {
    23  		delete(r, resource.key)
    24  	}
    25  	return r
    26  }
    27  
    28  func (r cloudResources) list() []cloudResource {
    29  	values := []cloudResource{}
    30  	for _, value := range r {
    31  		values = append(values, value)
    32  	}
    33  	return values
    34  }