Skip to content

Commit

Permalink
NET-5530 Generate deep-copy code (#18730)
Browse files Browse the repository at this point in the history
* Generate deep-copy code

* Undo license header removal
  • Loading branch information
nathancoleman authored Sep 8, 2023
1 parent 40d7ebc commit ed79c60
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions agent/structs/structs.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,28 @@ func (o *HTTPRouteConfigEntry) DeepCopy() *HTTPRouteConfigEntry {
if o.Rules[i2].Filters.JWT != nil {
cp.Rules[i2].Filters.JWT = o.Rules[i2].Filters.JWT.DeepCopy()
}
if o.Rules[i2].ResponseFilters.Headers != nil {
cp.Rules[i2].ResponseFilters.Headers = make([]HTTPHeaderFilter, len(o.Rules[i2].ResponseFilters.Headers))
copy(cp.Rules[i2].ResponseFilters.Headers, o.Rules[i2].ResponseFilters.Headers)
for i5 := range o.Rules[i2].ResponseFilters.Headers {
if o.Rules[i2].ResponseFilters.Headers[i5].Add != nil {
cp.Rules[i2].ResponseFilters.Headers[i5].Add = make(map[string]string, len(o.Rules[i2].ResponseFilters.Headers[i5].Add))
for k7, v7 := range o.Rules[i2].ResponseFilters.Headers[i5].Add {
cp.Rules[i2].ResponseFilters.Headers[i5].Add[k7] = v7
}
}
if o.Rules[i2].ResponseFilters.Headers[i5].Remove != nil {
cp.Rules[i2].ResponseFilters.Headers[i5].Remove = make([]string, len(o.Rules[i2].ResponseFilters.Headers[i5].Remove))
copy(cp.Rules[i2].ResponseFilters.Headers[i5].Remove, o.Rules[i2].ResponseFilters.Headers[i5].Remove)
}
if o.Rules[i2].ResponseFilters.Headers[i5].Set != nil {
cp.Rules[i2].ResponseFilters.Headers[i5].Set = make(map[string]string, len(o.Rules[i2].ResponseFilters.Headers[i5].Set))
for k7, v7 := range o.Rules[i2].ResponseFilters.Headers[i5].Set {
cp.Rules[i2].ResponseFilters.Headers[i5].Set[k7] = v7
}
}
}
}
if o.Rules[i2].Matches != nil {
cp.Rules[i2].Matches = make([]HTTPMatch, len(o.Rules[i2].Matches))
copy(cp.Rules[i2].Matches, o.Rules[i2].Matches)
Expand Down Expand Up @@ -495,6 +517,28 @@ func (o *HTTPRouteConfigEntry) DeepCopy() *HTTPRouteConfigEntry {
if o.Rules[i2].Services[i4].Filters.JWT != nil {
cp.Rules[i2].Services[i4].Filters.JWT = o.Rules[i2].Services[i4].Filters.JWT.DeepCopy()
}
if o.Rules[i2].Services[i4].ResponseFilters.Headers != nil {
cp.Rules[i2].Services[i4].ResponseFilters.Headers = make([]HTTPHeaderFilter, len(o.Rules[i2].Services[i4].ResponseFilters.Headers))
copy(cp.Rules[i2].Services[i4].ResponseFilters.Headers, o.Rules[i2].Services[i4].ResponseFilters.Headers)
for i7 := range o.Rules[i2].Services[i4].ResponseFilters.Headers {
if o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Add != nil {
cp.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Add = make(map[string]string, len(o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Add))
for k9, v9 := range o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Add {
cp.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Add[k9] = v9
}
}
if o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Remove != nil {
cp.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Remove = make([]string, len(o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Remove))
copy(cp.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Remove, o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Remove)
}
if o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Set != nil {
cp.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Set = make(map[string]string, len(o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Set))
for k9, v9 := range o.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Set {
cp.Rules[i2].Services[i4].ResponseFilters.Headers[i7].Set[k9] = v9
}
}
}
}
}
}
}
Expand Down

0 comments on commit ed79c60

Please sign in to comment.