def get_mocked_network_interface_data(self, security_group_id: str,
                                          owner_id: str, private_ip: str,
                                          subnet_id: str, vpc_id: str) -> dict:

        fullFormatDateMocking = FullFormatDateMocking()

        return {
            "Attachment": {
                "AttachTime": fullFormatDateMocking.getRandomTimeStringZ(),
                "AttachmentId": "eni-attach-" + get_exadecimal_sample(17),
                "DeleteOnTermination": True,
                "DeviceIndex": 0,
                "Status": "attached"
            },
            "Description":
            "",
            "Groups": [{
                "GroupName": "default",
                "GroupId": security_group_id
            }],
            "Ipv6Addresses": [],
            "MacAddress":
            get_mac_address(),
            "NetworkInterfaceId":
            "eni-" + get_exadecimal_sample(17),
            "OwnerId":
            owner_id,
            "PrivateDnsName":
            "ip-" + private_ip.replace(".", "-") + ".ec2.internal",
            "PrivateIpAddress":
            private_ip,
            "PrivateIpAddresses": [{
                "Primary":
                True,
                "PrivateDnsName":
                "ip-" + private_ip.replace(".", "-") + ".ec2.internal",
                "PrivateIpAddress":
                private_ip
            }],
            "SourceDestCheck":
            True,
            "Status":
            "in-use",
            "SubnetId":
            subnet_id,
            "VpcId":
            vpc_id,
            "InterfaceType":
            "interface"
        }
Example #2
0
    def generate(self) -> dict:

        owner_code = generate_owner_code()

        data = {
            "FunctionName":
            "firstResponse",
            "FunctionArn":
            "arn:aws:lambda:mo-east-1:" + owner_code +
            ":function:firstResponse",
            "Runtime":
            "python3.6",
            "Role":
            "arn:aws:iam::" + owner_code + ":role/service-role/firstResponse",
            "Handler":
            "lambda_function.lambda_handler",
            "CodeSize":
            random_until_n(1000000),
            "Description":
            "",
            "Timeout":
            3,
            "MemorySize":
            128,
            "LastModified":
            "2011-08-17T18:56:00.842+0000",
            "CodeSha256":
            generate_random_string_with_hard_chars(44),
            "Version":
            "$LATEST",
            "TracingConfig": {
                "Mode": "PassThrough"
            },
            "RevisionId":
            get_exadecimal_sample(8) + "-" + get_exadecimal_sample(4) + "-" +
            get_exadecimal_sample(4) + "-" + get_exadecimal_sample(4) + "-" +
            get_exadecimal_sample(12)
        }

        return data
    def describe_applications(self):

        request_id = get_exadecimal_sample(8) + "-" + get_exadecimal_sample(
            4) + "-" + get_exadecimal_sample(4) + "-" + get_exadecimal_sample(
                4) + "-" + get_exadecimal_sample(12)

        return {
            "Applications": [self.describe_single_application()],
            "ResponseMetadata": {
                "RequestId": request_id,
                "HTTPStatusCode": 200,
                "HTTPHeaders": {
                    "content-type": "text/xml",
                    "date": "Mon, 14 Sep 2020 23:37:52 GMT",
                    "vary": "accept-encoding",
                    "x-amzn-requestid": request_id,
                    "content-length": "12345",
                    "connection": "keep-alive"
                },
                "RetryAttempts": 0
            }
        }
Example #4
0
    def generate(self, count = 1) -> dict:
        aws_general_entities_mocker = AWS_General_Entities_Mocker()

        owner_id = aws_general_entities_mocker.get_owner_id()

        instance_single_generator = Instance_Single_Generator()
        instances = []
        for i in range(0, count):
            instances.append(instance_single_generator.generate())

        data = {
            "Reservations": [
                {
                    "Groups": [],
                    "Instances": instances,
                    "OwnerId": owner_id,
                    "ReservationId": "r-" + get_exadecimal_sample(17)
                }
            ]
        }

        return data
Example #5
0
 def __init__(self):
     self.group_id = "sg-" + get_exadecimal_sample(11)
 def test_get_exadecimal_sample_string_length_2(self):
     string_length = 8
     exadecimal_sample = get_exadecimal_sample(string_length)
     self.assertEqual(string_length, len(exadecimal_sample))
 def test_get_exadecimal_sample_return_type(self):
     exadecimal_sample = get_exadecimal_sample(12)
     self.assertTrue(isinstance(exadecimal_sample, str))
Example #8
0
 def get_vpc_id(self) -> str:
     return "vpc-" + get_exadecimal_sample(8)
Example #9
0
 def get_group_id(self):
     return "sg-" + get_exadecimal_sample(17)