'Set up the methods, integration responses and method responses for a given API Gateway resource.'

def create_and_setup_methods(self, restapi, resource, api_key_required, uri, authorization_type, authorizer_resource, depth):

    for method_name in self.http_methods:
        method = troposphere.apigateway.Method((method_name + str(depth)))
        method.RestApiId = troposphere.Ref(restapi)
        if (type(resource) is troposphere.apigateway.Resource):
            method.ResourceId = troposphere.Ref(resource)
        else:
            method.ResourceId = resource
        method.HttpMethod = method_name.upper()
        method.AuthorizationType = authorization_type
        if authorizer_resource:
            method.AuthorizerId = troposphere.Ref(authorizer_resource)
        method.ApiKeyRequired = api_key_required
        method.MethodResponses = []
        self.cf_template.add_resource(method)
        self.cf_api_resources.append(method.title)
        if (not self.credentials_arn):
            self.get_credentials_arn()
        credentials = self.credentials_arn
        integration = troposphere.apigateway.Integration()
        integration.CacheKeyParameters = []
        integration.CacheNamespace = 'none'
        integration.Credentials = credentials
        integration.IntegrationHttpMethod = 'POST'
        integration.IntegrationResponses = []
        integration.PassthroughBehavior = 'NEVER'
        integration.Type = 'AWS_PROXY'
        integration.Uri = uri
        method.Integration = integration
