moto/moto/ec2instanceconnect/models.py
Brian Pandola ae85c539fd Remove boto package dependency
The `boto` library (long ago superseded by `boto3`) has not had an official
release in over two years or even a commit in the last 18 months.  Importing
the package (or indirectly importing it by via `moto`) generates a deprecation
warning.  Additionally, an ever-increasing number of `moto` users who have
left `boto` behind for `boto3` are still being forced to install `boto`.

This commit vendors a very small subset of the `boto` library--only the code
required by `moto` to run--into the /packages subdirectory.  A README file
is included explaining the origin of the files and a recommendation for how
they can be removed entirely in a future release.

NOTE: Users of `boto` will still be able to use `moto` after this is merged.

closes #2978
closes #3013
closes #3170
closes #3418

relates to #2950
2020-11-26 23:59:15 -08:00

20 lines
735 B
Python

from boto3 import Session
import json
from moto.core import BaseBackend
class Ec2InstanceConnectBackend(BaseBackend):
def send_ssh_public_key(self):
return json.dumps(
{"RequestId": "example-2a47-4c91-9700-e37e85162cb6", "Success": True}
)
ec2instanceconnect_backends = {}
for region in Session().get_available_regions("ec2"):
ec2instanceconnect_backends[region] = Ec2InstanceConnectBackend()
for region in Session().get_available_regions("ec2", partition_name="aws-us-gov"):
ec2instanceconnect_backends[region] = Ec2InstanceConnectBackend()
for region in Session().get_available_regions("ec2", partition_name="aws-cn"):
ec2instanceconnect_backends[region] = Ec2InstanceConnectBackend()