Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send null logConfig if subnetwork is L7ILB #2635

Merged
merged 2 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9182,7 +9182,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding that check here instead? We only want to return nil if we would set it to false. That way the API will fail requests with the block set for real.

}

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

Expand Down