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

Convert inboundServices to an enum. #3820

Merged
merged 5 commits into from
Aug 6, 2020
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
32 changes: 28 additions & 4 deletions products/appengine/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,20 @@ objects:
- !ruby/object:Api::Type::Array
name: 'inboundServices'
description: |
Before an application can receive email or XMPP messages, the application must be configured to enable the service.
item_type: Api::Type::String
A list of the types of messages that this application is able to receive.
item_type: !ruby/object:Api::Type::Enum
name: 'inboundService'
description: |
One type of message that this application is able to receive.
values:
- :INBOUND_SERVICE_MAIL
- :INBOUND_SERVICE_MAIL_BOUNCE
- :INBOUND_SERVICE_XMPP_ERROR
- :INBOUND_SERVICE_XMPP_MESSAGE
- :INBOUND_SERVICE_XMPP_SUBSCRIBE
- :INBOUND_SERVICE_XMPP_PRESENCE
- :INBOUND_SERVICE_CHANNEL_PRESENCE
- :INBOUND_SERVICE_WARMUP
- !ruby/object:Api::Type::String
name: 'instanceClass'
description: |
Expand Down Expand Up @@ -631,8 +643,20 @@ objects:
- !ruby/object:Api::Type::Array
name: 'inboundServices'
description: |
Before an application can receive email or XMPP messages, the application must be configured to enable the service.
item_type: Api::Type::String
A list of the types of messages that this application is able to receive.
item_type: !ruby/object:Api::Type::Enum
name: 'inboundService'
description: |
One type of message that this application is able to receive.
values:
- :INBOUND_SERVICE_MAIL
- :INBOUND_SERVICE_MAIL_BOUNCE
- :INBOUND_SERVICE_XMPP_ERROR
- :INBOUND_SERVICE_XMPP_MESSAGE
- :INBOUND_SERVICE_XMPP_SUBSCRIBE
- :INBOUND_SERVICE_XMPP_PRESENCE
- :INBOUND_SERVICE_CHANNEL_PRESENCE
- :INBOUND_SERVICE_WARMUP
- !ruby/object:Api::Type::String
name: 'instanceClass'
description: |
Expand Down
2 changes: 1 addition & 1 deletion templates/terraform/flatten_property_method.erb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d
}
<% if !property.set_hash_func.nil? -%>
return schema.NewSet(<%= property.set_hash_func -%>, v.([]interface{}))
<% elsif property.item_type.is_a?(String) -%>
<% elsif property.item_type.is_a?(String) or property.item_type.is_a?(Api::Type::Enum) -%>
return schema.NewSet(schema.HashString, v.([]interface{}))
<% else raise 'Unknown hash function for property #{property.name}' -%>
<% end -%>
Expand Down
7 changes: 6 additions & 1 deletion templates/terraform/schema_property.erb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@
Elem: &schema.Schema{
Type: <%= tf_types[property.item_type_class] -%>,
},
<% elsif property.item_type.is_a?(Api::Type::Enum) -%>
Elem: &schema.Schema{
Type: <%= tf_types[property.item_type.class] -%>,
ValidateFunc: validation.StringInSlice([]string{"<%= property.item_type.values.join '","' -%>"}, false),
},
<% else # array of basic types -%>
Elem: &schema.Schema{
Type: <%= tf_types[property.item_type.class] -%>,
Expand All @@ -126,7 +131,7 @@
<% if property.is_set -%>
<% if !property.set_hash_func.nil? -%>
Set: <%= property.set_hash_func -%>,
<% elsif property.item_type.is_a?(String) -%>
<% elsif property.item_type.is_a?(String) or property.item_type.is_a?(Api::Type::Enum) -%>
Set: schema.HashString,
<% else -%>
// Default schema.HashSchema is used.
Expand Down