Beispiel #1
0
def sales_rank(config, asin):
    ecs = ECS(config['access_key'],
              config['secret_key'],
              config['associate_tag'])

    doc = ecs.request({'Operation': 'ItemLookup',
                       'ItemId': asin,
                       'ResponseGroup': 'SalesRank'})
    
    rank = doc.getElementsByTagName('SalesRank')[0]
    return int(rank.childNodes[0].nodeValue)
Beispiel #2
0
 def create_task_definition(self, *args, **kwargs):
     task_definition = ECS.create_task_definition(
         self,
         family=self.app_name,
         containers=self.container_definitions,
         **kwargs)
     self.task_definition = task_definition['taskDefinitionArn']
     return self.task_definition
Beispiel #3
0
 def create_service(self, **kwargs):
     service = ECS.create_service(self,
                                  cluster=self.cluster_name,
                                  service_name=self.service_name,
                                  task_definition=self.task_definition,
                                  desired_count=self.desired_count,
                                  max_health=self.max_health,
                                  min_health=self.min_health,
                                  **kwargs)
     self.service = service
     return self.service
Beispiel #4
0
 def define_container(self, image=None, name=None, **kwargs):
     if image is None:
         image = self.image
     if name is None:
         name = self.app_name
     container = ECS.define_container(self,
                                      image=image,
                                      name=name,
                                      **kwargs)
     self.container_definitions.append(container)
     return None
Beispiel #5
0
 def clearup(self):
     return ECS.clearup_cluster(self, self.cluster_name)
Beispiel #6
0
 def delete(self):
     return ECS.delete_cluster(self, cluster=self.cluster_name)
Beispiel #7
0
 def delete_services(self, services, *args, **kwargs):
     return ECS.delete_services(self,
                                cluster=self.cluster_name,
                                services=services)
Beispiel #8
0
 def set_count_services_zero(self, *args, **kwargs):
     return ECS.set_count_services_zero(self,
                                        cluster=self.cluster_name,
                                        services=self.list_services())
Beispiel #9
0
 def describe_services(self):
     return ECS.describe_services(self, self.cluster_name)
Beispiel #10
0
 def list_services(self, *args, **kwargs):
     return ECS.list_services(self, cluster=self.cluster_name)
Beispiel #11
0
 def stop_tasks(self, *args, **kwargs):
     return ECS.stop_tasks(self, cluster=self.cluster_name)
Beispiel #12
0
 def describe_tasks(self):
     return ECS.describe_tasks(self, self.cluster_name)
Beispiel #13
0
 def list_tasks(self, *args, **kwargs):
     return ECS.list_tasks(self, self.cluster_name)
Beispiel #14
0
 def list_task_definitions(self):
     return ECS.list_task_definitions(self, self.app_name)
Beispiel #15
0
 def create_cluster(self):
     cluster = ECS.create_cluster(self, name=self.cluster_name)
     self._cluster = cluster['clusterArn']
     return self.cluster