Merge pull request #9213 from DealerDotCom/feature/aws-api-gateway-integration-types

Allow new aws api-gateway integration types
This commit is contained in:
Paul Stack 2016-10-05 00:04:59 +01:00 committed by GitHub
commit 49438d4b46
3 changed files with 13 additions and 11 deletions

View File

@ -41,16 +41,9 @@ func resourceAwsApiGatewayIntegration() *schema.Resource {
}, },
"type": &schema.Schema{ "type": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Required: true, Required: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { ValidateFunc: validateApiGatewayIntegrationType,
value := v.(string)
if value != "MOCK" && value != "AWS" && value != "HTTP" {
errors = append(errors, fmt.Errorf(
"%q must be one of 'AWS', 'MOCK', 'HTTP'", k))
}
return
},
}, },
"uri": &schema.Schema{ "uri": &schema.Schema{

View File

@ -467,3 +467,12 @@ func validateJsonString(v interface{}, k string) (ws []string, errors []error) {
} }
return 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
}

View File

@ -46,7 +46,7 @@ The following arguments are supported:
* `rest_api_id` - (Required) The ID of the associated REST API * `rest_api_id` - (Required) The ID of the associated REST API
* `resource_id` - (Required) The API resource ID * `resource_id` - (Required) The API resource ID
* `http_method` - (Required) The HTTP method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTION`) * `http_method` - (Required) The HTTP method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTION`)
* `type` - (Required) The integration input's type (HTTP, MOCK, AWS) * `type` - (Required) The integration input's type (HTTP, MOCK, AWS, AWS_PROXY, HTTP_PROXY)
* `uri` - (Optional) The input's URI (HTTP, AWS). **Required** if `type` is `HTTP` or `AWS`. * `uri` - (Optional) The input's URI (HTTP, AWS). **Required** if `type` is `HTTP` or `AWS`.
For HTTP integrations, the URI must be a fully formed, encoded HTTP(S) URL according to the RFC-3986 specification . For AWS integrations, the URI should be of the form `arn:aws:apigateway:{region}:{subdomain.service|service}:{path|action}/{service_api}`. `region`, `subdomain` and `service` are used to determine the right endpoint. For HTTP integrations, the URI must be a fully formed, encoded HTTP(S) URL according to the RFC-3986 specification . For AWS integrations, the URI should be of the form `arn:aws:apigateway:{region}:{subdomain.service|service}:{path|action}/{service_api}`. `region`, `subdomain` and `service` are used to determine the right endpoint.
e.g. `arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:012345678901:function:my-func/invocations` e.g. `arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:012345678901:function:my-func/invocations`