Added references to moto.iam.models.ACCOUNT_ID instead of hardcoded id
This commit is contained in:
parent
6969c887e4
commit
b83a750630
54 changed files with 326 additions and 295 deletions
|
|
@ -13,8 +13,9 @@ import cryptography.hazmat.primitives.asymmetric.rsa
|
|||
from cryptography.hazmat.primitives import serialization, hashes
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
|
||||
|
||||
DEFAULT_ACCOUNT_ID = 123456789012
|
||||
GOOGLE_ROOT_CA = b"""-----BEGIN CERTIFICATE-----
|
||||
MIIEKDCCAxCgAwIBAgIQAQAhJYiw+lmnd+8Fe2Yn3zANBgkqhkiG9w0BAQsFADBC
|
||||
MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMS
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import time
|
|||
import boto3
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
|
||||
ACCOUNT_ID = 123456789012
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
|
||||
class TaggableResourceMixin(object):
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ from moto.dynamodbstreams import dynamodbstreams_backends
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
ACCOUNT_ID = "123456789012"
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -28,11 +28,10 @@ from .utils import (
|
|||
from moto.ec2.exceptions import InvalidSubnetIdError
|
||||
from moto.ec2.models import INSTANCE_TYPES as EC2_INSTANCE_TYPES
|
||||
from moto.iam.exceptions import IAMNotFoundException
|
||||
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
|
||||
_orig_adapter_send = requests.adapters.HTTPAdapter.send
|
||||
logger = logging.getLogger(__name__)
|
||||
DEFAULT_ACCOUNT_ID = 123456789012
|
||||
COMPUTE_ENVIRONMENT_NAME_REGEX = re.compile(
|
||||
r"^[A-Za-z0-9][A-Za-z0-9_-]{1,126}[A-Za-z0-9]$"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ from moto.route53 import models as route53_models
|
|||
from moto.s3 import models as s3_models
|
||||
from moto.sns import models as sns_models
|
||||
from moto.sqs import models as sqs_models
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from .utils import random_suffix
|
||||
from .exceptions import (
|
||||
ExportNotFound,
|
||||
|
|
@ -431,7 +432,7 @@ class ResourceMap(collections.Mapping):
|
|||
|
||||
# Create the default resources
|
||||
self._parsed_resources = {
|
||||
"AWS::AccountId": "123456789012",
|
||||
"AWS::AccountId": ACCOUNT_ID,
|
||||
"AWS::Region": self._region_name,
|
||||
"AWS::StackId": stack_id,
|
||||
"AWS::StackName": stack_name,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ from six.moves.urllib.parse import urlparse
|
|||
from moto.core.responses import BaseResponse
|
||||
from moto.core.utils import amzn_request_id
|
||||
from moto.s3 import s3_backend
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from .models import cloudformation_backends
|
||||
from .exceptions import ValidationError
|
||||
|
||||
|
|
@ -425,7 +426,7 @@ class CloudFormationResponse(BaseResponse):
|
|||
stackset = self.cloudformation_backend.get_stack_set(stackset_name)
|
||||
|
||||
if not stackset.admin_role:
|
||||
stackset.admin_role = "arn:aws:iam::123456789012:role/AWSCloudFormationStackSetAdministrationRole"
|
||||
stackset.admin_role = "arn:aws:iam::{AccountId}:role/AWSCloudFormationStackSetAdministrationRole".format(AccountId=ACCOUNT_ID)
|
||||
if not stackset.execution_role:
|
||||
stackset.execution_role = "AWSCloudFormationStackSetExecutionRole"
|
||||
|
||||
|
|
@ -1055,7 +1056,7 @@ DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = """<DescribeStackSetOperationRes
|
|||
<DescribeStackSetOperationResult>
|
||||
<StackSetOperation>
|
||||
<ExecutionRoleName>{{ stackset.execution_role }}</ExecutionRoleName>
|
||||
<AdministrationRoleARN>arn:aws:iam::123456789012:role/{{ stackset.admin_role }}</AdministrationRoleARN>
|
||||
<AdministrationRoleARN>arn:aws:iam::"""+ACCOUNT_ID+""":role/{{ stackset.admin_role }}</AdministrationRoleARN>
|
||||
<StackSetId>{{ stackset.id }}</StackSetId>
|
||||
<CreationTimestamp>{{ operation.CreationTimestamp }}</CreationTimestamp>
|
||||
<OperationId>{{ operation.OperationId }}</OperationId>
|
||||
|
|
@ -1080,7 +1081,7 @@ LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = """<ListStackSetOperationRe
|
|||
{% for account, region in instance.items() %}
|
||||
<member>
|
||||
<AccountGateResult>
|
||||
<StatusReason>Function not found: arn:aws:lambda:us-west-2:123456789012:function:AWSCloudFormationStackSetAccountGate</StatusReason>
|
||||
<StatusReason>Function not found: arn:aws:lambda:us-west-2:"""+ACCOUNT_ID+""":function:AWSCloudFormationStackSetAccountGate</StatusReason>
|
||||
<Status>SKIPPED</Status>
|
||||
</AccountGateResult>
|
||||
<Region>{{ region }}</Region>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import os
|
|||
import string
|
||||
|
||||
from cfnlint import decode, core
|
||||
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
def generate_stack_id(stack_name, region="us-east-1", account="123456789"):
|
||||
random_id = uuid.uuid4()
|
||||
|
|
@ -29,8 +29,8 @@ def generate_stackset_id(stackset_name):
|
|||
|
||||
|
||||
def generate_stackset_arn(stackset_id, region_name):
|
||||
return "arn:aws:cloudformation:{}:123456789012:stackset/{}".format(
|
||||
region_name, stackset_id
|
||||
return "arn:aws:cloudformation:{}:{}:stackset/{}".format(
|
||||
region_name, ACCOUNT_ID, stackset_id
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from dateutil.tz import tzutc
|
|||
from uuid import uuid4
|
||||
from .utils import make_arn_for_dashboard
|
||||
|
||||
DEFAULT_ACCOUNT_ID = 123456789012
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
|
||||
_EMPTY_LIST = tuple()
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ from moto.config.exceptions import (
|
|||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.s3.config import s3_config_query
|
||||
|
||||
DEFAULT_ACCOUNT_ID = "123456789012"
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
POP_STRINGS = [
|
||||
"capitalizeStart",
|
||||
"CapitalizeStart",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import json
|
|||
from moto.compat import OrderedDict
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.core.utils import unix_time
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from .comparisons import get_comparison_func
|
||||
|
||||
|
||||
|
|
@ -277,8 +278,8 @@ class Table(BaseModel):
|
|||
if attribute_name == "StreamArn":
|
||||
region = "us-east-1"
|
||||
time = "2000-01-01T00:00:00.000"
|
||||
return "arn:aws:dynamodb:{0}:123456789012:table/{1}/stream/{2}".format(
|
||||
region, self.name, time
|
||||
return "arn:aws:dynamodb:{0}:{1}:table/{2}/stream/{3}".format(
|
||||
region, ACCOUNT_ID, self.name, time
|
||||
)
|
||||
raise UnformattedGetAttTemplateException()
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from moto.core.responses import BaseResponse
|
|||
from moto.core.utils import camelcase_to_underscores
|
||||
from moto.ec2.utils import filters_from_querystring, dict_from_querystring
|
||||
from moto.elbv2 import elbv2_backends
|
||||
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
class InstanceResponse(BaseResponse):
|
||||
def describe_instances(self):
|
||||
|
|
@ -249,7 +249,7 @@ class InstanceResponse(BaseResponse):
|
|||
EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
|
||||
<reservationId>{{ reservation.id }}</reservationId>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>sg-245f6a01</groupId>
|
||||
|
|
@ -331,7 +331,7 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
|||
<vpcId>{{ nic.subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<description>Primary network interface</description>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<status>in-use</status>
|
||||
<macAddress>1b:2b:3c:4d:5e:6f</macAddress>
|
||||
<privateIpAddress>{{ nic.private_ip_address }}</privateIpAddress>
|
||||
|
|
@ -354,7 +354,7 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
|||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>123456789012</ipOwnerId>
|
||||
<ipOwnerId>"""+ACCOUNT_ID+"""</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
<privateIpAddressesSet>
|
||||
|
|
@ -364,7 +364,7 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
|||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>123456789012</ipOwnerId>
|
||||
<ipOwnerId>"""+ACCOUNT_ID+"""</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
</item>
|
||||
|
|
@ -383,7 +383,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
|||
{% for reservation in reservations %}
|
||||
<item>
|
||||
<reservationId>{{ reservation.id }}</reservationId>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<groupSet>
|
||||
{% for group in reservation.dynamic_group_list %}
|
||||
<item>
|
||||
|
|
@ -476,7 +476,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
|||
{% endfor %}
|
||||
</blockDeviceMapping>
|
||||
<virtualizationType>{{ instance.virtualization_type }}</virtualizationType>
|
||||
<clientToken>ABCDE1234567890123</clientToken>
|
||||
<clientToken>ABCDE"""+ACCOUNT_ID+"""3</clientToken>
|
||||
{% if instance.get_tags() %}
|
||||
<tagSet>
|
||||
{% for tag in instance.get_tags() %}
|
||||
|
|
@ -499,7 +499,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
|||
<vpcId>{{ nic.subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<description>Primary network interface</description>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<status>in-use</status>
|
||||
<macAddress>1b:2b:3c:4d:5e:6f</macAddress>
|
||||
<privateIpAddress>{{ nic.private_ip_address }}</privateIpAddress>
|
||||
|
|
@ -526,7 +526,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
|||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>123456789012</ipOwnerId>
|
||||
<ipOwnerId>"""+ACCOUNT_ID+"""</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
<privateIpAddressesSet>
|
||||
|
|
@ -536,7 +536,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
|||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>123456789012</ipOwnerId>
|
||||
<ipOwnerId>"""+ACCOUNT_ID+"""</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
from moto.core.responses import BaseResponse
|
||||
from moto.ec2.utils import filters_from_querystring
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
|
||||
def try_parse_int(value, default=None):
|
||||
|
|
@ -176,7 +177,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
|||
<securityGroupInfo>
|
||||
{% for group in groups %}
|
||||
<item>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<groupId>{{ group.id }}</groupId>
|
||||
<groupName>{{ group.name }}</groupName>
|
||||
<groupDescription>{{ group.description }}</groupDescription>
|
||||
|
|
@ -196,7 +197,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
|||
<groups>
|
||||
{% for source_group in rule.source_groups %}
|
||||
<item>
|
||||
<userId>123456789012</userId>
|
||||
<userId>"""+ACCOUNT_ID+"""</userId>
|
||||
<groupId>{{ source_group.id }}</groupId>
|
||||
<groupName>{{ source_group.name }}</groupName>
|
||||
</item>
|
||||
|
|
@ -225,7 +226,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
|||
<groups>
|
||||
{% for source_group in rule.source_groups %}
|
||||
<item>
|
||||
<userId>123456789012</userId>
|
||||
<userId>"""+ACCOUNT_ID+"""</userId>
|
||||
<groupId>{{ source_group.id }}</groupId>
|
||||
<groupName>{{ source_group.name }}</groupName>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
from moto.core.responses import BaseResponse
|
||||
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
class VPCPeeringConnections(BaseResponse):
|
||||
def create_vpc_peering_connection(self):
|
||||
|
|
@ -56,7 +56,7 @@ CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
|
|||
</peeringOptions>
|
||||
</requesterVpcInfo>
|
||||
<accepterVpcInfo>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<vpcId>{{ vpc_pcx.peer_vpc.id }}</vpcId>
|
||||
</accepterVpcInfo>
|
||||
<status>
|
||||
|
|
@ -82,7 +82,7 @@ DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
|
|||
<cidrBlock>{{ vpc_pcx.vpc.cidr_block }}</cidrBlock>
|
||||
</requesterVpcInfo>
|
||||
<accepterVpcInfo>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<vpcId>{{ vpc_pcx.peer_vpc.id }}</vpcId>
|
||||
<cidrBlock>{{ vpc_pcx.peer_vpc.cidr_block }}</cidrBlock>
|
||||
<peeringOptions>
|
||||
|
|
@ -120,7 +120,7 @@ ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
|
|||
<cidrBlock>{{ vpc_pcx.vpc.cidr_block }}</cidrBlock>
|
||||
</requesterVpcInfo>
|
||||
<accepterVpcInfo>
|
||||
<ownerId>123456789012</ownerId>
|
||||
<ownerId>"""+ACCOUNT_ID+"""</ownerId>
|
||||
<vpcId>{{ vpc_pcx.peer_vpc.id }}</vpcId>
|
||||
<cidrBlock>{{ vpc_pcx.peer_vpc.cidr_block }}</cidrBlock>
|
||||
<peeringOptions>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ from .utils import (
|
|||
random_policy_id,
|
||||
)
|
||||
|
||||
ACCOUNT_ID = 123456789012
|
||||
ACCOUNT_ID = '123456789012' #make sure this is a str and not an int
|
||||
|
||||
|
||||
class MFADevice(object):
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
import json
|
||||
from werkzeug.exceptions import BadRequest
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
|
||||
class ResourceNotFoundError(BadRequest):
|
||||
|
|
@ -23,14 +24,14 @@ class ResourceInUseError(BadRequest):
|
|||
class StreamNotFoundError(ResourceNotFoundError):
|
||||
def __init__(self, stream_name):
|
||||
super(StreamNotFoundError, self).__init__(
|
||||
"Stream {0} under account 123456789012 not found.".format(stream_name)
|
||||
"Stream {0} under account {1} not found.".format(stream_name, ACCOUNT_ID)
|
||||
)
|
||||
|
||||
|
||||
class ShardNotFoundError(ResourceNotFoundError):
|
||||
def __init__(self, shard_id):
|
||||
super(ShardNotFoundError, self).__init__(
|
||||
"Shard {0} under account 123456789012 not found.".format(shard_id)
|
||||
"Shard {0} under account {1} not found.".format(shard_id, ACCOUNT_ID)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from hashlib import md5
|
|||
from moto.compat import OrderedDict
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.core.utils import unix_time
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from .exceptions import (
|
||||
StreamNotFoundError,
|
||||
ShardNotFoundError,
|
||||
|
|
@ -133,7 +134,7 @@ class Stream(BaseModel):
|
|||
self.shard_count = shard_count
|
||||
self.creation_datetime = datetime.datetime.now()
|
||||
self.region = region
|
||||
self.account_number = "123456789012"
|
||||
self.account_number = ACCOUNT_ID
|
||||
self.shards = {}
|
||||
self.tags = {}
|
||||
self.status = "ACTIVE"
|
||||
|
|
@ -259,8 +260,8 @@ class DeliveryStream(BaseModel):
|
|||
|
||||
@property
|
||||
def arn(self):
|
||||
return "arn:aws:firehose:us-east-1:123456789012:deliverystream/{0}".format(
|
||||
self.name
|
||||
return "arn:aws:firehose:us-east-1:{1}:deliverystream/{0}".format(
|
||||
self.name, ACCOUNT_ID
|
||||
)
|
||||
|
||||
def destinations_to_dict(self):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.ec2 import ec2_backends
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
import uuid
|
||||
import datetime
|
||||
from random import choice
|
||||
|
|
@ -367,7 +368,7 @@ class Stack(BaseModel):
|
|||
self.id = "{0}".format(uuid.uuid4())
|
||||
self.layers = []
|
||||
self.apps = []
|
||||
self.account_number = "123456789012"
|
||||
self.account_number = ACCOUNT_ID
|
||||
self.created_at = datetime.datetime.utcnow()
|
||||
|
||||
def __eq__(self, other):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
|||
import random
|
||||
import string
|
||||
|
||||
MASTER_ACCOUNT_ID = "123456789012"
|
||||
from moto.iam.models import ACCOUNT_ID as MASTER_ACCOUNT_ID
|
||||
MASTER_ACCOUNT_EMAIL = "master@example.com"
|
||||
DEFAULT_POLICY_ID = "p-FullAWSAccess"
|
||||
ORGANIZATION_ARN_FORMAT = "arn:aws:organizations::{0}:organization/{1}"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from moto.core import BaseBackend, BaseModel
|
|||
from .resources import VOICE_DATA
|
||||
from .utils import make_arn_for_lexicon
|
||||
|
||||
DEFAULT_ACCOUNT_ID = 123456789012
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
|
||||
|
||||
class Lexicon(BaseModel):
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from .exceptions import (
|
|||
)
|
||||
|
||||
|
||||
ACCOUNT_ID = 123456789012
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
|
||||
class TaggableResourceMixin(object):
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import json
|
|||
import re
|
||||
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from .exceptions import BadRequestException
|
||||
|
||||
|
||||
|
|
@ -23,8 +24,8 @@ class FakeResourceGroup(BaseModel):
|
|||
if self._validate_tags(value=tags):
|
||||
self._tags = tags
|
||||
self._raise_errors()
|
||||
self.arn = "arn:aws:resource-groups:us-west-1:123456789012:{name}".format(
|
||||
name=name
|
||||
self.arn = "arn:aws:resource-groups:us-west-1:{AccountId}:{name}".format(
|
||||
name=name, AccountId=ACCOUNT_ID
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import xmltodict
|
|||
from moto.packages.httpretty.core import HTTPrettyRequest
|
||||
from moto.core.responses import _TemplateEnvironmentMixin, ActionAuthenticatorMixin
|
||||
from moto.core.utils import path_url
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
|
||||
from moto.s3bucket_path.utils import (
|
||||
bucket_name_from_url as bucketpath_bucket_name_from_url,
|
||||
|
|
@ -1898,7 +1899,7 @@ S3_ALL_MULTIPARTS = """<?xml version="1.0" encoding="UTF-8"?>
|
|||
<Key>{{ upload.key_name }}</Key>
|
||||
<UploadId>{{ upload.id }}</UploadId>
|
||||
<Initiator>
|
||||
<ID>arn:aws:iam::123456789012:user/user1-11111a31-17b5-4fb7-9df5-b111111f13de</ID>
|
||||
<ID>arn:aws:iam::"""+ACCOUNT_ID+""":user/user1-11111a31-17b5-4fb7-9df5-b111111f13de</ID>
|
||||
<DisplayName>user1-11111a31-17b5-4fb7-9df5-b111111f13de</DisplayName>
|
||||
</Initiator>
|
||||
<Owner>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
from moto.iam.models import ACCOUNT_ID
|
||||
"""
|
||||
SES Feedback messages
|
||||
Extracted from https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html
|
||||
|
|
@ -10,7 +11,7 @@ COMMON_MAIL = {
|
|||
"source": "sender@example.com",
|
||||
"sourceArn": "arn:aws:ses:us-west-2:888888888888:identity/example.com",
|
||||
"sourceIp": "127.0.3.0",
|
||||
"sendingAccountId": "123456789012",
|
||||
"sendingAccountId": ACCOUNT_ID,
|
||||
"destination": ["recipient@example.com"],
|
||||
"headersTruncated": False,
|
||||
"headers": [
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ from boto3 import Session
|
|||
|
||||
from moto.compat import OrderedDict
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from moto.core.utils import (
|
||||
iso_8601_datetime_with_milliseconds,
|
||||
camelcase_to_underscores,
|
||||
|
|
@ -31,7 +32,7 @@ from .exceptions import (
|
|||
)
|
||||
from .utils import make_arn_for_topic, make_arn_for_subscription, is_e164
|
||||
|
||||
DEFAULT_ACCOUNT_ID = 123456789012
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
DEFAULT_PAGE_SIZE = 100
|
||||
MAXIMUM_MESSAGE_LENGTH = 262144 # 256 KiB
|
||||
|
||||
|
|
@ -259,7 +260,7 @@ class Subscription(BaseModel):
|
|||
"SignatureVersion": "1",
|
||||
"Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",
|
||||
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
|
||||
"UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:123456789012:some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55",
|
||||
"UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:{}:some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55".format(ACCOUNT_ID),
|
||||
}
|
||||
if message_attributes:
|
||||
post_data["MessageAttributes"] = message_attributes
|
||||
|
|
@ -275,8 +276,8 @@ class PlatformApplication(BaseModel):
|
|||
|
||||
@property
|
||||
def arn(self):
|
||||
return "arn:aws:sns:{region}:123456789012:app/{platform}/{name}".format(
|
||||
region=self.region, platform=self.platform, name=self.name
|
||||
return "arn:aws:sns:{region}:{AccountId}:app/{platform}/{name}".format(
|
||||
region=self.region, platform=self.platform, name=self.name, AccountId=ACCOUNT_ID
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -305,8 +306,9 @@ class PlatformEndpoint(BaseModel):
|
|||
|
||||
@property
|
||||
def arn(self):
|
||||
return "arn:aws:sns:{region}:123456789012:endpoint/{platform}/{name}/{id}".format(
|
||||
return "arn:aws:sns:{region}:{AccountId}:endpoint/{platform}/{name}/{id}".format(
|
||||
region=self.region,
|
||||
AccountId=ACCOUNT_ID,
|
||||
platform=self.application.platform,
|
||||
name=self.application.name,
|
||||
id=self.id,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import boto.sqs
|
|||
|
||||
from moto.core.exceptions import RESTError
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.iam.models import ACCOUNT_ID
|
||||
from moto.core.utils import (
|
||||
camelcase_to_underscores,
|
||||
get_random_message_id,
|
||||
|
|
@ -32,7 +33,7 @@ from .exceptions import (
|
|||
InvalidAttributeName,
|
||||
)
|
||||
|
||||
DEFAULT_ACCOUNT_ID = 123456789012
|
||||
from moto.iam.models import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
|
||||
DEFAULT_SENDER_ID = "AIDAIT2UOQQY3AUEKVGXU"
|
||||
|
||||
MAXIMUM_MESSAGE_LENGTH = 262144 # 256 KiB
|
||||
|
|
@ -417,8 +418,8 @@ class Queue(BaseModel):
|
|||
return result
|
||||
|
||||
def url(self, request_url):
|
||||
return "{0}://{1}/123456789012/{2}".format(
|
||||
request_url.scheme, request_url.netloc, self.name
|
||||
return "{0}://{1}/{2}/{3}".format(
|
||||
request_url.scheme, request_url.netloc, ACCOUNT_ID, self.name
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue