Ejemplo n.º 1
0
 def create_tags(self):
     resource_ids = sequence_from_querystring('ResourceId', self.querystring)
     validate_resource_ids(resource_ids)
     self.ec2_backend.do_resources_exist(resource_ids)
     tags = tags_from_query_string(self.querystring)
     self.ec2_backend.create_tags(resource_ids, tags)
     return CREATE_RESPONSE
Ejemplo n.º 2
0
Archivo: tags.py Proyecto: Affirm/moto
 def delete_tags(self):
     resource_ids = self._get_multi_param('ResourceId')
     validate_resource_ids(resource_ids)
     tags = tags_from_query_string(self.querystring)
     if self.is_not_dryrun('DeleteTags'):
         self.ec2_backend.delete_tags(resource_ids, tags)
         return DELETE_RESPONSE
Ejemplo n.º 3
0
    def create_flow_logs(self):
        resource_type = self._get_param("ResourceType")
        resource_ids = self._get_multi_param("ResourceId")
        traffic_type = self._get_param("TrafficType")
        deliver_logs_permission_arn = self._get_param("DeliverLogsPermissionArn")
        log_destination_type = self._get_param("LogDestinationType")
        log_destination = self._get_param("LogDestination")
        log_group_name = self._get_param("LogGroupName")
        log_format = self._get_param("LogFormat")
        max_aggregation_interval = self._get_param("MaxAggregationInterval")
        validate_resource_ids(resource_ids)

        tags = self._parse_tag_specification()
        tags = tags.get("vpc-flow-log", {})
        if self.is_not_dryrun("CreateFlowLogs"):
            flow_logs, errors = self.ec2_backend.create_flow_logs(
                resource_type=resource_type,
                resource_ids=resource_ids,
                traffic_type=traffic_type,
                deliver_logs_permission_arn=deliver_logs_permission_arn,
                log_destination_type=log_destination_type,
                log_destination=log_destination,
                log_group_name=log_group_name,
                log_format=log_format,
                max_aggregation_interval=max_aggregation_interval,
            )
            for fl in flow_logs:
                fl.add_tags(tags)
            template = self.response_template(CREATE_FLOW_LOGS_RESPONSE)
            return template.render(flow_logs=flow_logs, errors=errors)
Ejemplo n.º 4
0
 def delete_tags(self):
     resource_ids = self._get_multi_param("ResourceId")
     validate_resource_ids(resource_ids)
     tags = tags_from_query_string(self.querystring)
     if self.is_not_dryrun("DeleteTags"):
         self.ec2_backend.delete_tags(resource_ids, tags)
         return DELETE_RESPONSE
Ejemplo n.º 5
0
 def create_tags(self):
     resource_ids = sequence_from_querystring('ResourceId', self.querystring)
     validate_resource_ids(resource_ids)
     self.ec2_backend.do_resources_exist(resource_ids)
     tags = tags_from_query_string(self.querystring)
     self.ec2_backend.create_tags(resource_ids, tags)
     return CREATE_RESPONSE
Ejemplo n.º 6
0
 def delete_tags(self):
     resource_ids = sequence_from_querystring('ResourceId',
                                              self.querystring)
     validate_resource_ids(resource_ids)
     tags = tags_from_query_string(self.querystring)
     self.ec2_backend.delete_tags(resource_ids, tags)
     return DELETE_RESPONSE
Ejemplo n.º 7
0
Archivo: tags.py Proyecto: Affirm/moto
 def create_tags(self):
     resource_ids = self._get_multi_param('ResourceId')
     validate_resource_ids(resource_ids)
     self.ec2_backend.do_resources_exist(resource_ids)
     tags = tags_from_query_string(self.querystring)
     if self.is_not_dryrun('CreateTags'):
         self.ec2_backend.create_tags(resource_ids, tags)
         return CREATE_RESPONSE
Ejemplo n.º 8
0
 def create_tags(self):
     resource_ids = self._get_multi_param("ResourceId")
     validate_resource_ids(resource_ids)
     self.ec2_backend.do_resources_exist(resource_ids)
     tags = tags_from_query_string(self.querystring)
     if self.is_not_dryrun("CreateTags"):
         self.ec2_backend.create_tags(resource_ids, tags)
         return CREATE_RESPONSE
Ejemplo n.º 9
0
 def delete_tags(self):
     resource_ids = sequence_from_querystring('ResourceId', self.querystring)
     validate_resource_ids(resource_ids)
     tags = tags_from_query_string(self.querystring)
     self.ec2_backend.delete_tags(resource_ids, tags)
     return DELETE_RESPONSE