github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/resources/security_groups.go (about)

     1  package resources
     2  
     3  import "code.cloudfoundry.org/cli/cf/models"
     4  
     5  type PaginatedSecurityGroupResources struct {
     6  	Resources []SecurityGroupResource
     7  }
     8  
     9  type SecurityGroupResource struct {
    10  	Resource
    11  	Entity SecurityGroup
    12  }
    13  
    14  type SecurityGroup struct {
    15  	models.SecurityGroupFields
    16  	Spaces []SpaceResource
    17  }
    18  
    19  func (resource SecurityGroupResource) ToFields() (fields models.SecurityGroupFields) {
    20  	fields.Name = resource.Entity.Name
    21  	fields.Rules = resource.Entity.Rules
    22  	fields.SpaceURL = resource.Entity.SpaceURL
    23  	fields.GUID = resource.Metadata.GUID
    24  
    25  	return
    26  }
    27  
    28  func (resource SecurityGroupResource) ToModel() (asg models.SecurityGroup) {
    29  	asg.SecurityGroupFields = resource.ToFields()
    30  	return
    31  }