Cloud Defense Logo

Products

Solutions

Company

Book A Live Demo

Top 10 Examples of "troposphere in functional component" in Python

Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'troposphere' in functional components in Python. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.

def test_eq(self):
        metadata = 'foo'
        description = 'bar'
        resource = Bucket('Baz')
        output = Output('qux', Value='qux')

        t1 = Template(Description=description, Metadata=metadata)
        t1.add_resource(resource)
        t1.add_output(output)

        t2 = Template(Description=description, Metadata=metadata)
        t2.add_resource(resource)
        t2.add_output(output)

        self.assertEqual(t1, t2)
def test_check_zip_file(self):
        positive_tests = [
            'a'*4096,
            Join('', ['a'*4096]),
            Join('', ['a', 10]),
            Join('', ['a'*4096, Ref('EmptyParameter')]),
            Join('ab', ['a'*2047, 'a'*2047]),
            GetAtt('foo', 'bar'),
        ]
        for z in positive_tests:
            Code.check_zip_file(z)
        negative_tests = [
            'a'*4097,
            Join('', ['a'*4097]),
            Join('', ['a'*4097, Ref('EmptyParameter')]),
            Join('abc', ['a'*2047, 'a'*2047]),
        ]
        for z in negative_tests:
            with self.assertRaises(ValueError):
                Code.check_zip_file(z)
def get_aws_objects(self):
        result = []
        modules = self._import_all_modules()
        for module in modules:
            for name in dir(module):
                obj = getattr(module, name)
                if (
                        isinstance(obj, type) and
                        obj != AWSObject and
                        issubclass(obj, AWSObject)
                ):
                    result.append(obj)
        return result
def test_implicit_ref_in_a_tuple(self):
        t = Template()
        r1 = FakeAWSObject('r1')
        t.add_resource(r1)
        r2 = FakeAWSObject('r2', listproperty=[1, (2, r1)])
        t.add_resource(r2)
        self.assertJsonEquals(t, {
            'Resources': {
                'r1': {
                    'Type': "Fake::AWS::Object",
                    },
                'r2': {
                    'Type': "Fake::AWS::Object",
                    'Properties': {
                        'listproperty': [
                            1,
                            [
                                2,
def test_parameter_group(self):
        t = Template()
        p1 = t.add_parameter(Parameter("Foo"))
        t.add_parameter(Parameter("Bar"))
        t.add_parameter_to_group(p1, "gr")
        t.add_parameter_to_group("Bar", "gr")

        self.assertEqual(t.metadata, {
            "AWS::CloudFormation::Interface": {
                "ParameterGroups": [
                    {
                        "Label": {"default": "gr"},
                        "Parameters": ["Foo", "Bar"],
                    },
def __init__(self):
        self.name = 'ec2.template'
        self.template = Template()

        self.template.add_version("2010-09-09")
        self.test_parameter_groups = TestParameterGroups()
        default_test_params = TestParameterGroup()
        self.test_parameter_groups.add(default_test_params)

        Environment = self.template.add_parameter(Parameter(
            "Environment",
            Default="Development",
            Type="String",
            Description="Application environment",
            AllowedValues=["Development", "Integration",
                           "PreProduction", "Production", "Staging", "Test"],
        ))
        default_test_params.add(TestParameter("Environment", "Integration"))
def test_securitygroupegress(self):
        egress = ec2.SecurityGroupEgress(
            'egress',
            ToPort='80',
            FromPort='80',
            IpProtocol="tcp",
            GroupId="id",
            CidrIp="0.0.0.0/0",
        )
        egress.to_dict()

        egress = ec2.SecurityGroupEgress(
            'egress',
            ToPort='80',
            FromPort='80',
            IpProtocol="tcp",
            GroupId="id",
            DestinationPrefixListId='id',
def createCouchbaseSecurityGroups(t):

        # Couchbase security group
        secGrpCouchbase = ec2.SecurityGroup('CouchbaseSecurityGroup')
        secGrpCouchbase.GroupDescription = "Allow access to Couchbase Server"
        secGrpCouchbase.SecurityGroupIngress = [
            ec2.SecurityGroupRule(
                IpProtocol="tcp",
                FromPort="22",
                ToPort="22",
                CidrIp="0.0.0.0/0",
            ),
            ec2.SecurityGroupRule(
                IpProtocol="tcp",
                FromPort="8091",
                ToPort="8096",
                CidrIp="0.0.0.0/0",
            ),
            ec2.SecurityGroupRule(
                IpProtocol="tcp",
def test_TagConditional(self):
        tags = Tags(
            {'foo': 'foo'},
            If('MyCondition', Tag('bar', 'bar'), Tag('baz', 'baz'))
        )
        result = [
            {"Fn::If": ["MyCondition",
                        {"Key": "bar", "Value": "bar"},
                        {"Key": "baz", "Value": "baz"}]},
            {'Value': 'foo', 'Key': 'foo'},
        ]
        self.assertEqual(tags.to_dict(), result)
def test_Formats(self):
        result = [
            {'Value': 'bar', 'Key': 'bar'},
            {'Value': 'baz', 'Key': 'baz'},
            {'Value': 'foo', 'Key': 'foo'},
        ]
        tags = Tags(bar='bar', baz='baz', foo='foo')
        self.assertEqual(tags.to_dict(), result)
        tags = Tags({'bar': 'bar', 'baz': 'baz', 'foo': 'foo'})
        self.assertEqual(tags.to_dict(), result)
        tags = Tags(**{'bar': 'bar', 'baz': 'baz', 'foo': 'foo'})
        self.assertEqual(tags.to_dict(), result)
        result = [{'Key': 'test-tag', 'Value': '123456'}]
        tags = Tags({'test-tag': '123456'})
        self.assertEqual(tags.to_dict(), result)

        with self.assertRaises(TypeError):
            Tags(1)
        with self.assertRaises(TypeError):
            Tags("tag")
        with self.assertRaises(TypeError):
            Tags("key", "value")
        with self.assertRaises(TypeError):

Is your System Free of Underlying Vulnerabilities?
Find Out Now