Exemplo n.º 1
0
 def create_instance(self, **params):
     request = CreateInstanceRequest()
     instance_id = _get_response(self._client,
                                 request,
                                 params,
                                 key='InstanceId')
     return ECSInstanceResource(instance_id, _client=self._client)
Exemplo n.º 2
0
 def allocate_eip_address(self, **params):
     request = AllocateEipAddressRequest()
     allocate_id = _get_response(self._client,
                                 request,
                                 params,
                                 key='AllocationId')
     return VPCEipAddressResource(allocate_id, _client=self._client)
Exemplo n.º 3
0
 def create_load_balancer(self, **params):
     request = CreateLoadBalancerRequest()
     load_balancer_id = _get_response(self._client,
                                      request,
                                      params,
                                      key='LoadBalancerId')
     return LoadBalancerResource(load_balancer_id, _client=self._client)
Exemplo n.º 4
0
 def create_simulated_system_events(self, **params):
     request = CreateSimulatedSystemEventsRequest()
     event_ids = _get_response(self._client, request, params, "EventIdSet.EventId")
     events = []
     for event_id in event_ids:
         event = ECSSystemEventResource(event_id, _client=self._client)
         events.append(event)
     return events
Exemplo n.º 5
0
 def refresh(self):
     request = DescribeInstancesRequest()
     request.set_InstanceIds(json.dumps([self.instance_id]))
     items = _get_response(self._client, request, {}, 'Instances.Instance')
     if not items:
         raise ClientException(errors.ERROR_INVALID_SERVER_RESPONSE,
                               "Failed to find instance data from DescribeInstances response. "
                               "InstanceId = {0}".format(self.instance_id))
     self._assign_attributes(items[0])
Exemplo n.º 6
0
    def run_instances(self, **params):
        request = RunInstancesRequest()
        instance_ids = _get_response(self._client, request, params, 'InstanceIdSets.InstanceIdSet')

        instances = []
        for instance_id in instance_ids:
            instance = ECSInstanceResource(instance_id, _client=self._client)
            instances.append(instance)
        return instances
Exemplo n.º 7
0
 def refresh(self):
     request = DescribeInstanceHistoryEventsRequest()
     request.set_EventIds([self.event_id])
     items = _get_response(self._client, request, {},
                           'InstanceSystemEventSet.InstanceSystemEventType')
     if not items:
         raise ClientException(errors.ERROR_INVALID_SERVER_RESPONSE,
                               "Failed to find event data from "
                               "DescribeInstanceHistoryEventsRequest response. "
                               "EventId = {0}".format(self.event_id))
     self._assign_attributes(items[0])
Exemplo n.º 8
0
 def refresh(self):
     request = DescribeImagesRequest()
     request.set_ImageId(self.image_id)
     items = _get_response(self._client, request, {}, 'Images.Image')
     if not items:
         raise ClientException(
             errors.ERROR_INVALID_SERVER_RESPONSE,
             "Failed to find image data from DescribeImages "
             "response. "
             "ImageId = {0}".format(self.image_id))
     self._assign_attributes(items[0])
Exemplo n.º 9
0
 def refresh(self):
     request = DescribeDisksRequest()
     request.set_DiskIds(json.dumps([self.disk_id]))
     items = _get_response(self._client, request, {}, 'Disks.Disk')
     if not items:
         raise ClientException(
             errors.ERROR_INVALID_SERVER_RESPONSE,
             "Failed to find disk data from DescribeDiks "
             "response. "
             "DiskId = {0}".format(self.disk_id))
     self._assign_attributes(items[0])
Exemplo n.º 10
0
 def refresh(self):
     request = DescribeEipAddressesRequest()
     request.set_AllocationId(self.allocation_id)
     items = _get_response(self._client, request, {},
                           'EipAddresses.EipAddress')
     if not items:
         raise ClientException(
             errors.ERROR_INVALID_SERVER_RESPONSE,
             "Failed to find EIP Address data from DescribeEipAddresses "
             "response. "
             "AllocationId = {0}".format(self.allocation_id))
     self._assign_attributes(items[0])
Exemplo n.º 11
0
 def refresh(self):
     request = DescribeLoadBalancersRequest()
     request.set_LoadBalancerId(self.load_balancer_id)
     items = _get_response(self._client, request, {},
                           'LoadBalancers.LoadBalancer')
     if not items:
         raise ClientException(
             errors.ERROR_INVALID_SERVER_RESPONSE,
             "Failed to find load balancer data from DescribeLoadBalancers "
             "response. "
             "LoadBalancerId = {0}".format(self.load_balancer_id))
     self._assign_attributes(items[0])
Exemplo n.º 12
0
 def create_image(self, **params):
     request = CreateImageRequest()
     image_id = _get_response(self._client, request, params, key='ImageId')
     return ECSImageResource(image_id, _client=self._client)
Exemplo n.º 13
0
 def create_disk(self, **params):
     request = CreateDiskRequest()
     disk_id = _get_response(self._client, request, params, key='DiskId')
     return ECSDiskResource(disk_id, _client=self._client)