def _construct_rest_api(self):
rest_api = ApiGatewayRestApi(self.logical_id, depends_on=self.depends_on, attributes=self.resource_attributes)<EOL>rest_api.BinaryMediaTypes = self.binary_media<EOL>rest_api.MinimumCompressionSize = self.minimum_compression_size<EOL>if self.endpoint_configuration:<EOL><INDENT>self._set_endpoint_configuration(rest_api, self.endpoint_configuration)<EOL><DEDENT>elif not RegionConfiguration.is_apigw_edge_configuration_supported():<EOL><INDENT>self._set_endpoint_configuration(rest_api, "<STR_LIT>")<EOL><DEDENT>if self.definition_uri and self.definition_body:<EOL><INDENT>raise InvalidResourceException(self.logical_id,<EOL>"<STR_LIT>")<EOL><DEDENT>self._add_cors()<EOL>self._add_auth()<EOL>self._add_gateway_responses()<EOL>if self.definition_uri:<EOL><INDENT>rest_api.BodyS3Location = self._construct_body_s3_dict()<EOL><DEDENT>elif self.definition_body:<EOL><INDENT>rest_api.Body = self.definition_body<EOL><DEDENT>if self.name:<EOL><INDENT>rest_api.Name = self.name<EOL><DEDENT>return rest_api<EOL>
Constructs and returns the ApiGateway RestApi.

        :returns: the RestApi to which this SAM Api corresponds
        :rtype: model.apigateway.ApiGatewayRestApi