internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: localstack/localstack

Issue:
ListStackResources does not have LastUpdatedTimestamp field
# Type of request: This is a ...

bug report

# Detailed description

aws cloudformation list-stack-resources --stack-name "mystack" 
{
    "StackResourceSummaries": [
        {
            "LogicalResourceId": "MyS3Bucket",
            "PhysicalResourceId": "mystack",
            "ResourceType": "AWS::S3::Bucket",
            "ResourceStatus": "CREATE_COMPLETE"
        }
    ]
}

**LastUpdatedTimestamp** is not returned.
...

## Expected behavior

Trying to use Localstack with some dependencies which expects the field LastUpdatedTimestamp. I saw in few older posts the field was being returned.





Discussion:

Resolving patch:
diff --git a/localstack/services/cloudformation/cloudformation_api.py b/localstack/services/cloudformation/cloudformation_api.py
--- a/localstack/services/cloudformation/cloudformation_api.py
+++ b/localstack/services/cloudformation/cloudformation_api.py
@@ -127,6 +127,7 @@ def set_resource_status(self, resource_id, status, physical_res_id=None):
         state['StackName'] = state.get('StackName') or self.stack_name
         state['StackId'] = state.get('StackId') or self.stack_id
         state['ResourceType'] = state.get('ResourceType') or self.resources[resource_id].get('Type')
+        state['LastUpdatedTimestamp'] = timestamp_millis()
         self.add_stack_event(resource_id, physical_res_id, status)
 
     def resource_status(self, resource_id):


Test patch:
Repository: localstack/localstack

Issue:
threading.Thread.currentThread has been deprecated in favour of current_thread in Python 3.10
Ref : https://github.com/python/cpython/pull/25174

https://github.com/localstack/localstack/blob/5a5edcd9d9ccbd6a56f23d71e3a1131b8c814996/localstack/utils/common.py#L324


Discussion:
Thanks for reporting @tirkarthi - do you think you can create a small pull request with this change? Thanks for your help!

Resolving patch:
diff --git a/localstack/utils/common.py b/localstack/utils/common.py
--- a/localstack/utils/common.py
+++ b/localstack/utils/common.py
@@ -289,7 +289,7 @@ def proxy():
         return proxy
 
     def _ident(self):
-        return threading.currentThread().ident
+        return threading.current_thread().ident
 
     def stdout(self):
         return self._stdout.getvalue() if hasattr(self._stdout, 'getvalue') else self._stdout


Test patch:
Repository: localstack/localstack

Issue:
Support ruby2.7 runtime
AWS supports the following Ruby runtimes:

<!--StartFragment-->
Name | Identifier | SDK for Ruby | Operating system
-- | -- | -- | --
Ruby 2.7 | ruby2.7 | 3.0.1 | Amazon Linux 2
Ruby 2.5 | ruby2.5 | 3.0.1 | Amazon Linux

<!--EndFragment-->

Currently, `localstack/lambda` only contains the `ruby2.5` tag. Will the 2.7 runtime be supported in the (near) future?


Discussion:
In addition to that (taken from [here](https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html)):

<!--StartFragment-->
Name | Identifier | Operating system | End of support phase 1 start | End of support phase 2 start
-- | -- | -- | -- | --
Ruby 2.5 | ruby2.5 | Amazon Linux | July 30, 2021 | Aug 30, 2021

<!--EndFragment-->



Resolving patch:
diff --git a/localstack/services/awslambda/lambda_utils.py b/localstack/services/awslambda/lambda_utils.py
--- a/localstack/services/awslambda/lambda_utils.py
+++ b/localstack/services/awslambda/lambda_utils.py
@@ -22,6 +22,7 @@
 LAMBDA_RUNTIME_GOLANG = 'go1.x'
 LAMBDA_RUNTIME_RUBY = 'ruby'
 LAMBDA_RUNTIME_RUBY25 = 'ruby2.5'
+LAMBDA_RUNTIME_RUBY27 = 'ruby2.7'
 LAMBDA_RUNTIME_PROVIDED = 'provided'
 
 # default handler and runtime


Test patch:
diff --git a/tests/integration/test_lambda.py b/tests/integration/test_lambda.py
--- a/tests/integration/test_lambda.py
+++ b/tests/integration/test_lambda.py
@@ -29,9 +29,9 @@
 from localstack.services.awslambda.lambda_api import (
     use_docker, BATCH_SIZE_RANGES, INVALID_PARAMETER_VALUE_EXCEPTION, LAMBDA_DEFAULT_HANDLER)
 from localstack.services.awslambda.lambda_utils import (
-    LAMBDA_RUNTIME_DOTNETCORE2, LAMBDA_RUNTIME_DOTNETCORE31, LAMBDA_RUNTIME_RUBY25, LAMBDA_RUNTIME_PYTHON27,
-    LAMBDA_RUNTIME_PYTHON36, LAMBDA_RUNTIME_JAVA8, LAMBDA_RUNTIME_JAVA11, LAMBDA_RUNTIME_NODEJS810,
-    LAMBDA_RUNTIME_PROVIDED, LAMBDA_RUNTIME_PYTHON37, LAMBDA_RUNTIME_NODEJS14X)
+    LAMBDA_RUNTIME_DOTNETCORE2, LAMBDA_RUNTIME_DOTNETCORE31, LAMBDA_RUNTIME_RUBY27,
+    LAMBDA_RUNTIME_PYTHON27, LAMBDA_RUNTIME_PYTHON36, LAMBDA_RUNTIME_JAVA8, LAMBDA_RUNTIME_JAVA11,
+    LAMBDA_RUNTIME_NODEJS810, LAMBDA_RUNTIME_PROVIDED, LAMBDA_RUNTIME_PYTHON37, LAMBDA_RUNTIME_NODEJS14X)
 from .lambdas import lambda_integration
 
 THIS_FOLDER = os.path.dirname(os.path.realpath(__file__))
@@ -1433,7 +1433,7 @@ def test_ruby_lambda_running_in_docker(self):
             func_name=TEST_LAMBDA_NAME_RUBY,
             handler_file=TEST_LAMBDA_RUBY,
             handler='lambda_integration.handler',
-            runtime=LAMBDA_RUNTIME_RUBY25
+            runtime=LAMBDA_RUNTIME_RUBY27
         )
         result = self.lambda_client.invoke(
             FunctionName=TEST_LAMBDA_NAME_RUBY, Payload=b'{}')
Repository: localstack/localstack

Issue:
AWS Lambda PutFunctionEventInvokeConfig returns LastModified timestamp in incorrect format
<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[x] bug report
[ ] feature request

# Detailed description
When I call the Lambda PutFunctionEventInvokeConfig API using the aws-java-sdk, the sdk throws an exception claiming it cannot parse the LastModified timestamp in the response:
```
software.amazon.awssdk.core.exception.SdkClientException: Unable to parse date : 2021-05-28T16:02:30.018Z
        at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:98)
        at software.amazon.awssdk.protocols.core.StringToInstant.lambda$safeParseDate$0(StringToInstant.java:77)
        at software.amazon.awssdk.protocols.core.StringToInstant.convert(StringToInstant.java:54)
        at software.amazon.awssdk.protocols.core.StringToInstant.convert(StringToInstant.java:32)
```

For comparison, the response for a getting a FunctionEventInvokeConfig for a Lambda of a real AWS account using the aws-cli is the following:
```
{
    "LastModified": "2021-05-27T19:26:43.454000-07:00",
    "FunctionArn": "...",
    ...
}
```

## Expected behavior
LambdaAsyncClient in aws-java-sdk should correctly parse the response for a PutFunctionEventInvokeConfig request.

## Actual behavior
LambdaAsyncClient in aws-java-sdk throws an exception when parsing the LastModified field in the response.

# Steps to reproduce

## Command used to start LocalStack
```
docker run -d --rm --name localstack -p 4566:4566 localstack/localstack:latest
```

## Client code (AWS SDK code snippet, or sequence of "awslocal" commands)
```
val putEventInvokeConfigRequest =
  PutFunctionEventInvokeConfigRequest.builder
    .functionName(functionName)
    .maximumEventAgeInSeconds(21600)
    .maximumRetryAttempts(0)
    .build
lambdaClient.putFunctionEventInvokeConfig(putEventInvokeConfigRequest)
```




Discussion:

Resolving patch:
diff --git a/localstack/services/awslambda/lambda_api.py b/localstack/services/awslambda/lambda_api.py
--- a/localstack/services/awslambda/lambda_api.py
+++ b/localstack/services/awslambda/lambda_api.py
@@ -59,6 +59,8 @@
     'sqs': (10, 10)
 }
 
+DATE_FORMAT = '%Y-%m-%dT%H:%M:%S.%f+00:00'
+
 app = Flask(APP_NAME)
 
 # mutex for access to CWD and ENV
@@ -1753,7 +1755,7 @@ def put_function_event_invoke_config(function):
     response = lambda_obj.put_function_event_invoke_config(data)
 
     return jsonify({
-        'LastModified': timestamp_millis(response.last_modified),
+        'LastModified': response.last_modified.strftime(DATE_FORMAT),
         'FunctionArn': str(function_arn),
         'MaximumRetryAttempts': response.max_retry_attempts,
         'MaximumEventAgeInSeconds': response.max_event_age,


Test patch:
Repository: localstack/localstack

Issue:
bug: kinesis register-stream-consumer returns error StreamARN not found
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

I cannot register a consumer using `register-stream-consumer`.

### Expected Behavior

I should be able to register a stream consumer without problem.

### How are you starting LocalStack?

With a `docker run` command

### Steps To Reproduce

- Start localstack `docker run --rm -it -p 4566:4566 -p 4571:4571 localstack/localstack:0.12.17`
- Create a kinesis stream `aws --endpoint-url http://localhost:4566 kinesis create-stream --stream-name kinesisStream --shard-count 1`
- Get the arn of that created stream `aws --endpoint-url http://localhost:4566 kinesis describe-stream --stream-name kinesisStream | jq .StreamDescription.StreamARN` (returns `arn:aws:kinesis:us-west-2:000000000000:stream/kinesisStream`)
- Create a consumer `aws --endpoint-url http://localhost:4566 kinesis register-stream-consumer --consumer-name myConsumer --stream-arn arn:aws:kinesis:us-west-2:000000000000:stream/kinesisStream`
- Get error `An error occurred (ResourceNotFoundException) when calling the RegisterStreamConsumer operation: StreamARN arn:aws:kinesis:us-west-2:000000000000:stream/kinesisStream not found` 

### Environment

```markdown
- OS: macOS 11.5.2 
- LocalStack: 0.12.17
```


### Anything else?

_No response_


Discussion:

Resolving patch:
diff --git a/localstack/services/install.py b/localstack/services/install.py
--- a/localstack/services/install.py
+++ b/localstack/services/install.py
@@ -86,7 +86,7 @@
 )
 
 # kinesis-mock version
-KINESIS_MOCK_VERSION = os.environ.get("KINESIS_MOCK_VERSION") or "0.1.9"
+KINESIS_MOCK_VERSION = os.environ.get("KINESIS_MOCK_VERSION") or "0.2.0"
 KINESIS_MOCK_RELEASE_URL = (
     "https://api.github.com/repos/etspaceman/kinesis-mock/releases/tags/" + KINESIS_MOCK_VERSION
 )


Test patch:
Repository: localstack/localstack

Issue:
Version 0.12.18 breaks elasticmq functionality
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Starting the localstack docker using the elasticmq SQS backend results in not being able to send any messages.  Appears to work fine in 0.12.17

### Expected Behavior

Messages should send fine.

### How are you starting LocalStack?

With a `docker run` command

### Steps To Reproduce

Run docker with:
```
docker run --rm -it -p 4566:4566 --env SERVICES=sqs --env SQS_PROVIDER=elasticmq --env DEBUG=1 localstack/localstack:0.12.18
```
Execute a simple SQS send:
```
AWS_ACCESS_KEY_ID=x AWS_SECRET_ACCESS_KEY=y aws --endpoint-url=http://localhost:4566 sqs create-queue --queue-name foo && aws --endpoint-url=http://localhost:4566 sqs send-message --queue-url "http://localhost:4658/000000000000/foo" --message-body foo
```
results in failure:
```
Unable to parse response (not well-formed (invalid token): line 1, column 0), invalid XML received. Further retries may succeed:
b'{}'
```

### Environment

```markdown
- OS: macOS 11.6
- LocalStack: 0.12.18
```


### Anything else?

I'm pretty sure that commit e38778888534cb6d98f27edaf5af76c1e1d29e06 broke the functionality.  I _think_ the `_process_sent_message` function is assuming something about the response that just isn't true, but I haven't gotten any further in my analysis.

Also, I need to use elasticmq because the moto implementation is just not fast enough.  We've been using an older release (0.11.3), using elasticmq, and I can send and receive 10,000 2K bodies in about 25 seconds, but using 0.12.18 and moto I can only send about 1200 and receive about 450 in those 25 seconds, and the slowdown just isn't acceptable for our integration tests.


Discussion:

Resolving patch:
diff --git a/localstack/services/sqs/sqs_listener.py b/localstack/services/sqs/sqs_listener.py
--- a/localstack/services/sqs/sqs_listener.py
+++ b/localstack/services/sqs/sqs_listener.py
@@ -214,15 +214,15 @@ def _process_sent_message(path: str, req_data: Dict[str, str], headers: Dict, re
 
     # extract data from XML response - assume data is wrapped in 2 parent elements
     response_data = xmltodict.parse(response.content)
-    response_data = list(response_data.values())[0]
-    response_data = list(response_data.values())[0]
 
     messages = []
     if action == "SendMessage":
+        response_data = response_data["SendMessageResponse"]["SendMessageResult"]
         message = clone(req_data)
         message.update(response_data)
         messages.append(message)
     elif action == "SendMessageBatch":
+        response_data = response_data["SendMessageBatchResponse"]["SendMessageBatchResult"]
         messages = parse_urlencoded_data(req_data, "SendMessageBatchRequestEntry")
         # Note: only forwarding messages from 'Successful', not from 'Failed' list
         entries = response_data.get("SendMessageBatchResultEntry") or []


Test patch:
Repository: localstack/localstack

Issue:
question: ENABLE_CONFIG_UPDATES for docker image
### Is there an existing issue for this?

- [x] I have searched the existing issues and read the documentation

### Question

Seems like ENABLE_CONFIG_UPDATES=1 works only in host mode.
Is there way to enable it for docker ?

### Anything else?

_No response_


Discussion:

Resolving patch:
diff --git a/localstack/config.py b/localstack/config.py
--- a/localstack/config.py
+++ b/localstack/config.py
@@ -354,6 +354,7 @@ def is_linux():
     "EXTRA_CORS_ALLOWED_HEADERS",
     "EXTRA_CORS_EXPOSE_HEADERS",
     "EXTRA_CORS_ALLOWED_ORIGINS",
+    "ENABLE_CONFIG_UPDATES",
 ]
 
 for key, value in six.iteritems(DEFAULT_SERVICE_PORTS):


Test patch:
Repository: localstack/localstack

Issue:
feature request: Update Elastic Search to 7.10 for supporting case insensitive term queries
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Feature description

As a DEVELOPER for a Bayer project we need LocalStack with Elastic Search version 7.10.

In version 7.10 `case_insensitive` option were be added. [Term Query Doc](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/query-dsl-term-query.html)

## Remarks
- 7.10 is the latest version under free Apache 2.0 license.
- Switching to [Opensearch](https://github.com/opensearch-project/OpenSearch) would be also possible.

### 🧑‍💻 Implementation

_No response_

### Anything else?

_No response_


Discussion:
Hello @meichhorn-conet, have you tried with the param [ELASTICSEARCH_DEFAULT_VERSION](https://github.com/localstack/localstack/blob/f720fe42e727c2c290d7babea3363bf7f8a357f8/localstack/services/es/cluster.py#L70)? You should be able to set that up to 7.10.2 (for example) and make it work, let me know if you need anything!
On the OpenSearch side, while the team is working on it, I think for now you can [run your own ES cluster](https://github.com/localstack/localstack/blob/master/doc/external_services_integration/elasticsearch/HOWTO.md).

Resolving patch:
diff --git a/localstack/constants.py b/localstack/constants.py
--- a/localstack/constants.py
+++ b/localstack/constants.py
@@ -93,12 +93,13 @@
 
 # installation constants
 ELASTICSEARCH_URLS = {
+    "7.10.0": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-linux-x86_64.tar.gz",
     "7.7.0": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.7.0-linux-x86_64.tar.gz",
     "7.4.0": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.4.0-linux-x86_64.tar.gz",
     "7.1.0": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.0-linux-x86_64.tar.gz",
     "6.7.0": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.zip",
 }
-ELASTICSEARCH_DEFAULT_VERSION = "7.7.0"
+ELASTICSEARCH_DEFAULT_VERSION = "7.10.0"
 # See https://docs.aws.amazon.com/ja_jp/elasticsearch-service/latest/developerguide/aes-supported-plugins.html
 ELASTICSEARCH_PLUGIN_LIST = [
     "analysis-icu",


Test patch:
Repository: localstack/localstack

Issue:
bug: PROVIDER_OVERRIDE_<provider> env vars are not passed through with the CLI
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Starting localstack with the CLI `PROVIDER_OVERRIDE_SQS=asf bin/localstack --debug start` starts up correctly but then uses the `default` SQS provider.

### Expected Behavior

I would expect it to start the asf provider.

### How are you starting LocalStack?

With the `localstack` script

### Steps To Reproduce

* `PROVIDER_OVERRIDE_SQS=asf bin/localstack --debug start`
* `awslocal sqs create-queue --queue-name "test-queue"`

logs show:

```
2021-12-27T14:08:43.274:DEBUG:plugin.manager: instantiating plugin PluginSpec(localstack.aws.provider.sqs:default = <function sqs at 0x7f30e6d2b820>)
2021-12-27T14:08:43.274:DEBUG:plugin.manager: loading plugin localstack.aws.provider:sqs:default
2021-12-27T14:08:43.278:INFO:localstack.services.infra: Starting mock SQS service on http port 4566 ...
2021-12-27T14:08:43.279:INFO:localstack.services.infra: Starting mock SQS service on http port 4566 ...
2021-12-27T14:08:43.279:INFO:localstack.services.motoserver: starting moto server on http://0.0.0.0:38335
```

### Environment

```markdown
- OS: Ubuntu 20.04
- LocalStack: 13.2
```


### Anything else?

_No response_


Discussion:

Resolving patch:
diff --git a/localstack/config.py b/localstack/config.py
--- a/localstack/config.py
+++ b/localstack/config.py
@@ -539,6 +539,7 @@ def is_linux():
         clean_key + "_BACKEND",
         clean_key + "_PORT",
         clean_key + "_PORT_EXTERNAL",
+        "PROVIDER_OVERRIDE_" + clean_key,
     ]
 
 
@@ -827,7 +828,9 @@ def __iter__(self):
 
 for key, value in os.environ.items():
     if key.startswith("PROVIDER_OVERRIDE_"):
-        SERVICE_PROVIDER_CONFIG.set_provider(key.lstrip("PROVIDER_OVERRIDE_").lower(), value)
+        SERVICE_PROVIDER_CONFIG.set_provider(
+            key.lstrip("PROVIDER_OVERRIDE_").lower().replace("_", "-"), value
+        )
 
 # initialize directories
 if is_in_docker:


Test patch:
Repository: localstack/localstack

Issue:
ASF scaffold creates ugly method names for acronyms
When generating API stubs with the scaffold utility using, e.g., `python -m localstack.aws.scaffold sns`,
the scaffold creates method names from operation names, which are ugly when acronyms (subsequent uppercase characters that belong together).

Example:
`CreateSMSSandboxPhoneNumber` -> `create_s_m_s_sandbox_phone_number`

it would be nicer to have `create_sms_sandbox_phone_number`

This is a limitation of this method: https://github.com/localstack/localstack/blob/1888e66b85d7e6a8ee457bc7a732984fcf7aa830/localstack/utils/common.py#L978-L979


Discussion:

Resolving patch:
diff --git a/localstack/utils/common.py b/localstack/utils/common.py
--- a/localstack/utils/common.py
+++ b/localstack/utils/common.py
@@ -975,8 +975,11 @@ def fix_keys(o, path="", **kwargs):
     return result
 
 
+_camel_to_snake_case_sub = re.compile("((?<=[a-z0-9])[A-Z]|(?!^)[A-Z](?=[a-z]))")
+
+
 def camel_to_snake_case(string: str) -> str:
-    return re.sub(r"(?<!^)(?=[A-Z])", "_", string).replace("__", "_").lower()
+    return _camel_to_snake_case_sub.sub(r"_\1", string).replace("__", "_").lower()
 
 
 def snake_to_camel_case(string: str, capitalize_first: bool = True) -> str:


Test patch:
diff --git a/tests/unit/test_common.py b/tests/unit/test_common.py
--- a/tests/unit/test_common.py
+++ b/tests/unit/test_common.py
@@ -263,7 +263,12 @@ def test_camel_to_snake_case(self):
         self.assertEqual("foo_bar_ed", fn("FooBarEd"))
         self.assertEqual("foo_bar", fn("Foo_Bar"))
         self.assertEqual("foo__bar", fn("Foo__Bar"))
-        self.assertEqual("foo_b_a_r", fn("FooBAR"))
+        self.assertEqual("foo_bar", fn("FooBAR"))
+        self.assertEqual("http_request", fn("HTTPRequest"))
+        self.assertEqual("http_request", fn("HTTP_Request"))
+        self.assertEqual("verify_http_request", fn("VerifyHTTPRequest"))
+        self.assertEqual("is_http", fn("IsHTTP"))
+        self.assertEqual("is_http2_request", fn("IsHTTP2Request"))
 
     def test_snake_to_camel_case(self):
         fn = common.snake_to_camel_case
Repository: localstack/localstack

Issue:
feature request:  Support email-json for SNS subscription
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Feature description

I would like to request extending `sns_listener` with an ability to understand `email-json` next to `email` protocol.

### 🧑‍💻 Implementation

1. check if protocol is `email` or `email-json`
2. for email json interpret body/message as json

### Anything else?

_No response_


Discussion:
Hi @kornicameister , thanks for reporting. Looks like you already have a fairly good idea about the implementation approach for this feature - do you think you could create a first draft pull request with these changes? That would be really appreciated. Thanks!

Resolving patch:
diff --git a/localstack/services/sns/sns_listener.py b/localstack/services/sns/sns_listener.py
--- a/localstack/services/sns/sns_listener.py
+++ b/localstack/services/sns/sns_listener.py
@@ -613,7 +613,7 @@ async def message_to_subscriber(
             sns_error_to_dead_letter_queue(subscriber["SubscriptionArn"], req_data, str(exc))
         return
 
-    elif subscriber["Protocol"] == "email":
+    elif subscriber["Protocol"] in ["email", "email-json"]:
         ses_client = aws_stack.connect_to_service("ses")
         if subscriber.get("Endpoint"):
             ses_client.verify_email_address(EmailAddress=subscriber.get("Endpoint"))
@@ -622,7 +622,15 @@ async def message_to_subscriber(
             ses_client.send_email(
                 Source="admin@localstack.com",
                 Message={
-                    "Body": {"Text": {"Data": message}},
+                    "Body": {
+                        "Text": {
+                            "Data": create_sns_message_body(
+                                subscriber=subscriber, req_data=req_data, message_id=message_id
+                            )
+                            if subscriber["Protocol"] == "email-json"
+                            else message
+                        }
+                    },
                     "Subject": {"Data": "SNS-Subscriber-Endpoint"},
                 },
                 Destination={"ToAddresses": [subscriber.get("Endpoint")]},


Test patch: