Skip to content

Commit

Permalink
Send null logConfig if subnetwork is L7ILB (#2635)
Browse files Browse the repository at this point in the history
* Send null logConfig if subnetwork is L7ILB

* Move subnet ilb check to only if logConfig unspecified
  • Loading branch information
slevenick authored and rileykarson committed Nov 13, 2019
1 parent 00bf1c0 commit f8731a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9184,7 +9184,8 @@ objects:
update_id: 'logConfig'
description: |
Denotes the logging options for the subnetwork flow logs. If logging is enabled
logs will be exported to Stackdriver.
logs will be exported to Stackdriver. This field cannot be set if the `purpose` of this
subnetwork is `INTERNAL_HTTPS_LOAD_BALANCER`
properties:
- !ruby/object:Api::Type::Enum
name: 'aggregationInterval'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d T
l := v.([]interface{})
transformed := make(map[string]interface{})
if len(l) == 0 || l[0] == nil {
purpose, ok := d.GetOkExists("purpose")

if ok && purpose.(string) == "INTERNAL_HTTPS_LOAD_BALANCER" {
// Subnetworks for L7ILB do not accept any values for logConfig
return nil, nil
}
// send enable = false to ensure logging is disabled if there is no config
transformed["enable"] = false
return transformed, nil
}

raw := l[0]
original := raw.(map[string]interface{})

Expand Down

0 comments on commit f8731a0

Please sign in to comment.