Extract integration type validator
This commit is contained in:
parent
71b62d83b2
commit
ad8bff98bb
|
@ -43,14 +43,7 @@ func resourceAwsApiGatewayIntegration() *schema.Resource {
|
|||
"type": &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
Required: true,
|
||||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
if value != "MOCK" && value != "AWS" && value != "HTTP" && value != "AWS_PROXY" && value != "HTTP_PROXY" {
|
||||
errors = append(errors, fmt.Errorf(
|
||||
"%q must be one of 'AWS', 'MOCK', 'HTTP', 'AWS_PROXY', 'HTTP_PROXY'", k))
|
||||
}
|
||||
return
|
||||
},
|
||||
ValidateFunc: validateApiGatewayIntegrationType,
|
||||
},
|
||||
|
||||
"uri": &schema.Schema{
|
||||
|
|
|
@ -467,3 +467,12 @@ func validateJsonString(v interface{}, k string) (ws []string, errors []error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
|
||||
func validateApiGatewayIntegrationType(v interface{}, k string) (ws []string, errors []error) {
|
||||
value := v.(string)
|
||||
if value != "MOCK" && value != "AWS" && value != "HTTP" && value != "AWS_PROXY" && value != "HTTP_PROXY" {
|
||||
errors = append(errors, fmt.Errorf(
|
||||
"%q must be one of 'AWS', 'MOCK', 'HTTP', 'AWS_PROXY', 'HTTP_PROXY'", k))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue