Esempio n. 1
0
 def startElement(self, name, attrs, connection):
     if name == 'HealthCheck':
         self.health_check = HealthCheck(self)
         return self.health_check
     elif name == 'ListenerDescriptions':
         self.listeners = ResultSet([('member', Listener)])
         return self.listeners
     elif name == 'AvailabilityZones':
         return self.availability_zones
     elif name == 'Instances':
         self.instances = ResultSet([('member', InstanceInfo)])
         return self.instances
     elif name == 'Policies':
         self.policies = Policies(self)
         return self.policies
     elif name == 'SourceSecurityGroup':
         self.source_security_group = SecurityGroup()
         return self.source_security_group
     elif name == 'Subnets':
         return self.subnets
     elif name == 'SecurityGroups':
         return self.security_groups
     elif name == 'VPCId':
         pass
     elif name == "BackendServerDescriptions":
         self.backends = ResultSet([('member', Backend)])
         return self.backends
     else:
         return None
Esempio n. 2
0
 def startElement(self, name, attrs, connection):
     if name == 'Granularities':
         self.granularities = ResultSet([('member', self.Granularity)])
         return self.granularities
     elif name == 'Metrics':
         self.metrics = ResultSet([('member', self.Metric)])
         return self.metrics
Esempio n. 3
0
 def startElement(self, name, attrs, connection):
     if name == 'Args':
         self.args = ResultSet([('member', Arg)])
         return self.args
     if name == 'Properties':
         self.properties = ResultSet([('member', KeyValue)])
         return self.properties
Esempio n. 4
0
 def startElement(self, name, attrs, connection):
     if name == 'instanceCounts':
         self.instance_counts = ResultSet([('item', InstanceCount)])
         return self.instance_counts
     elif name == 'priceSchedules':
         self.price_schedules = ResultSet([('item', PriceSchedule)])
         return self.price_schedules
     return None
Esempio n. 5
0
 def startElement(self, name, attrs, connection):
     if name == 'recurringCharges':
         self.recurring_charges = ResultSet([('item', RecurringCharge)])
         return self.recurring_charges
     elif name == 'pricingDetailsSet':
         self.pricing_details = ResultSet([('item', PricingDetail)])
         return self.pricing_details
     return None
Esempio n. 6
0
 def startElement(self, name, attrs, connection):
     if name == "Parameters":
         self.template_parameters = ResultSet([('member', TemplateParameter)])
         return self.template_parameters
     elif name == "Capabilities":
         self.capabilities = ResultSet([('member', Capability)])
         return self.capabilities
     else:
         return None
Esempio n. 7
0
 def startElement(self, name, attrs, connection):
     if name == 'instancesSet':
         self.instances = ResultSet([('item', Instance)])
         return self.instances
     elif name == 'groupSet':
         self.groups = ResultSet([('item', Group)])
         return self.groups
     else:
         return None
Esempio n. 8
0
 def startElement(self, name, attrs, connection):
     if name == 'reservedInstancesSet':
         self.reserved_instances = ResultSet([('item', ReservedInstance)])
         return self.reserved_instances
     elif name == 'modificationResultSet':
         self.modification_results = ResultSet([('item', ModificationResult)
                                                ])
         return self.modification_results
     return None
Esempio n. 9
0
 def startElement(self, name, attrs, connection):
     if name == 'OptionSettings':
         self.settings = ResultSet([('OptionSettings', OptionSetting)])
     elif name == 'DBSecurityGroupMemberships':
         self.db_security_groups = ResultSet([('DBSecurityGroupMemberships',
                                               DBSecurityGroup)])
     elif name == 'VpcSecurityGroupMemberships':
         self.vpc_security_groups = ResultSet([
             ('VpcSecurityGroupMemberships', VpcSecurityGroup)
         ])
     else:
         return None
Esempio n. 10
0
 def startElement(self, name, attrs, connection):
     if name == 'AppCookieStickinessPolicies':
         rs = ResultSet([('member', AppCookieStickinessPolicy)])
         self.app_cookie_stickiness_policies = rs
         return rs
     elif name == 'LBCookieStickinessPolicies':
         rs = ResultSet([('member', LBCookieStickinessPolicy)])
         self.lb_cookie_stickiness_policies = rs
         return rs
     elif name == 'OtherPolicies':
         rs = ResultSet([('member', OtherPolicy)])
         self.other_policies = rs
         return rs
Esempio n. 11
0
 def startElement(self, name, attrs, connection):
     retval = super(VpnConnection,
                    self).startElement(name, attrs, connection)
     if retval is not None:
         return retval
     if name == 'vgwTelemetry':
         self.tunnels = ResultSet([('item', VpnTunnel)])
         return self.tunnels
     elif name == 'routes':
         self.static_routes = ResultSet([('item', VpnStaticRoute)])
         return self.static_routes
     elif name == 'options':
         self.options = VpnConnectionOptions()
         return self.options
     return None
Esempio n. 12
0
    def startElement(self, name, attrs, connection):
        result = super(NetworkAcl, self).startElement(name, attrs, connection)

        if result is not None:
            # Parent found an interested element, just return it
            return result

        if name == 'entrySet':
            self.network_acl_entries = ResultSet([('item', NetworkAclEntry)])
            return self.network_acl_entries
        elif name == 'associationSet':
            self.associations = ResultSet([('item', NetworkAclAssociation)])
            return self.associations
        else:
            return None
Esempio n. 13
0
    def startElement(self, name, attrs, connection):
        result = super(RouteTable, self).startElement(name, attrs, connection)

        if result is not None:
            # Parent found an interested element, just return it
            return result

        if name == 'routeSet':
            self.routes = ResultSet([('item', Route)])
            return self.routes
        elif name == 'associationSet':
            self.associations = ResultSet([('item', RouteAssociation)])
            return self.associations
        else:
            return None
Esempio n. 14
0
 def startElement(self, name, attrs, connection):
     if name == 'Steps':
         self.steps = ResultSet([('member', Step)])
         return self.steps
     elif name == 'InstanceGroups':
         self.instancegroups = ResultSet([('member', InstanceGroup)])
         return self.instancegroups
     elif name == 'BootstrapActions':
         self.bootstrapactions = ResultSet([('member', BootstrapAction)])
         return self.bootstrapactions
     elif name == 'SupportedProducts':
         self.supported_products = ResultSet([('member', SupportedProduct)])
         return self.supported_products
     else:
         return None
Esempio n. 15
0
 def startElement(self, name, attrs, connection):
     if name == 'Status':
         self.status = ClusterStatus()
         return self.status
     elif name == 'Ec2InstanceAttributes':
         self.ec2instanceattributes = Ec2InstanceAttributes()
         return self.ec2instanceattributes
     elif name == 'Applications':
         self.applications = ResultSet([('member', Application)])
         return self.applications
     elif name == 'Tags':
         self.tags = ResultSet([('member', KeyValue)])
         return self.tags
     else:
         return None
Esempio n. 16
0
 def startElement(self, name, attrs, connection):
     retval = super(NetworkInterface,
                    self).startElement(name, attrs, connection)
     if retval is not None:
         return retval
     if name == 'groupSet':
         self.groups = ResultSet([('item', Group)])
         return self.groups
     elif name == 'attachment':
         self.attachment = Attachment()
         return self.attachment
     elif name == 'privateIpAddressesSet':
         self.private_ip_addresses = ResultSet([('item', PrivateIPAddress)])
         return self.private_ip_addresses
     else:
         return None
Esempio n. 17
0
 def startElement(self, name, attrs, connection):
     if name == 'OptionGroupOptionSettings':
         self.settings = ResultSet([('OptionGroupOptionSettings',
                                     OptionGroupOptionSetting)])
     elif name == 'OptionsDependedOn':
         self.depends_on = []
     else:
         return None
Esempio n. 18
0
 def startElement(self, name, attrs, connection):
     if name == 'blockDeviceMapping':
         self[name] = BlockDeviceMapping()
         return self[name]
     elif name == 'groupSet':
         self[name] = ResultSet([('item', Group)])
         return self[name]
     else:
         return None
Esempio n. 19
0
 def startElement(self, name, attrs, connection):
     if name == "Parameters":
         self.parameters = ResultSet([('member', Parameter)])
         return self.parameters
     elif name == "Outputs":
         self.outputs = ResultSet([('member', Output)])
         return self.outputs
     elif name == "Capabilities":
         self.capabilities = ResultSet([('member', Capability)])
         return self.capabilities
     elif name == "Tags":
         self.tags = Tag()
         return self.tags
     elif name == 'NotificationARNs':
         self.notification_arns = ResultSet([('member', NotificationARN)])
         return self.notification_arns
     else:
         return None
Esempio n. 20
0
 def endElement(self, name, value, connection):
     # the answer consists of embedded XML, so it needs to be parsed independantly
     if name == 'Answer':
         answer_rs = ResultSet([('Answer', QuestionFormAnswer)])
         h = handler.XmlHandler(answer_rs, connection)
         value = connection.get_utf8_value(value)
         xml.sax.parseString(value, h)
         self.answers.append(answer_rs)
     else:
         super(Assignment, self).endElement(name, value, connection)
Esempio n. 21
0
 def get_all_buckets(self, headers=None):
     response = self.make_request('GET', headers=headers)
     body = response.read()
     if response.status > 300:
         raise self.provider.storage_response_error(response.status,
                                                    response.reason, body)
     rs = ResultSet([('Bucket', self.bucket_class)])
     h = handler.XmlHandler(rs, self)
     if not isinstance(body, bytes):
         body = body.encode('utf-8')
     xml.sax.parseString(body, h)
     return rs
Esempio n. 22
0
 def startElement(self, name, attrs, connection):
     retval = super(Volume, self).startElement(name, attrs, connection)
     if retval is not None:
         return retval
     if name == 'attachmentSet':
         self.attach_data = AttachmentSet()
         return self.attach_data
     elif name == 'tagSet':
         self.tags = ResultSet([('item', Tag)])
         return self.tags
     else:
         return None
Esempio n. 23
0
    def startElement(self, name, attrs, connection):
        result = super(InternetGateway,
                       self).startElement(name, attrs, connection)

        if result is not None:
            # Parent found an interested element, just return it
            return result

        if name == 'attachmentSet':
            self.attachments = ResultSet([('item', InternetGatewayAttachment)])
            return self.attachments
        else:
            return None
Esempio n. 24
0
 def startElement(self, name, attrs, connection):
     if name == 'Instances':
         self.instances = ResultSet([('member', Instance)])
         return self.instances
     elif name == 'LoadBalancerNames':
         return self.load_balancers
     elif name == 'AvailabilityZones':
         return self.availability_zones
     elif name == 'EnabledMetrics':
         self.enabled_metrics = ResultSet([('member', EnabledMetric)])
         return self.enabled_metrics
     elif name == 'SuspendedProcesses':
         self.suspended_processes = ResultSet([('member', SuspendedProcess)
                                               ])
         return self.suspended_processes
     elif name == 'Tags':
         self.tags = ResultSet([('member', Tag)])
         return self.tags
     elif name == 'TerminationPolicies':
         return self.termination_policies
     else:
         return
Esempio n. 25
0
 def startElement(self, name, attrs, connection):
     if name == 'groupSet':
         self.groups = ResultSet([('item', Group)])
         return self.groups
     elif name == 'monitoring':
         self._in_monitoring_element = True
     elif name == 'blockDeviceMapping':
         self.block_device_mapping = BlockDeviceMapping()
         return self.block_device_mapping
     elif name == 'iamInstanceProfile':
         self.instance_profile = SubParse('iamInstanceProfile')
         return self.instance_profile
     else:
         return None
Esempio n. 26
0
 def _process_response(self, response, marker_elems=None):
     """
     Helper to process the xml response from AWS
     """
     body = response.read()
     if self.debug == 2:
         print(body)
     if '<Errors>' not in body.decode('utf-8'):
         rs = ResultSet(marker_elems)
         h = handler.XmlHandler(rs, self)
         xml.sax.parseString(body, h)
         return rs
     else:
         raise MTurkRequestError(response.status, response.reason, body)
Esempio n. 27
0
 def startElement(self, name, attrs, connection):
     if name == 'SecurityGroups':
         return self.security_groups
     elif name == 'ClassicLinkVPCSecurityGroups':
         return self.classic_link_vpc_security_groups
     elif name == 'BlockDeviceMappings':
         if self.use_block_device_types:
             self.block_device_mappings = BDM()
         else:
             self.block_device_mappings = ResultSet([('member',
                                                      BlockDeviceMapping)])
         return self.block_device_mappings
     elif name == 'InstanceMonitoring':
         self.instance_monitoring = InstanceMonitoring(self)
         return self.instance_monitoring
Esempio n. 28
0
 def startElement(self, name, attrs, connection):
     retval = super(Instance, self).startElement(name, attrs, connection)
     if retval is not None:
         return retval
     if name == 'monitoring':
         self._in_monitoring_element = True
     elif name == 'blockDeviceMapping':
         self.block_device_mapping = BlockDeviceMapping()
         return self.block_device_mapping
     elif name == 'productCodes':
         return self.product_codes
     elif name == 'stateReason':
         self.state_reason = SubParse('stateReason')
         return self.state_reason
     elif name == 'groupSet':
         self.groups = ResultSet([('item', Group)])
         return self.groups
     elif name == "eventsSet":
         self.eventsSet = SubParse('eventsSet')
         return self.eventsSet
     elif name == 'networkInterfaceSet':
         self.interfaces = ResultSet([('item', NetworkInterface)])
         return self.interfaces
     elif name == 'iamInstanceProfile':
         self.instance_profile = SubParse('iamInstanceProfile')
         return self.instance_profile
     elif name == 'currentState':
         return self._state
     elif name == 'previousState':
         self._previous_state = InstanceState()
         return self._previous_state
     elif name == 'instanceState':
         return self._state
     elif name == 'placement':
         return self._placement
     return None
Esempio n. 29
0
    def get_storage_class(self):
        """
        Returns the StorageClass for the bucket.

        :rtype: str
        :return: The StorageClass for the bucket.
        """
        response = self.connection.make_request('GET',
                                                self.name,
                                                query_args=STORAGE_CLASS_ARG)
        body = response.read()
        if response.status == 200:
            rs = ResultSet(self)
            h = handler.XmlHandler(rs, self)
            xml.sax.parseString(body, h)
            return rs.StorageClass
        else:
            raise self.connection.provider.storage_response_error(
                response.status, response.reason, body)
Esempio n. 30
0
 def startElement(self, name, attrs, connection):
     if name == 'Args':
         self.args = ResultSet([('member', Arg)])
         return self.args