Ejemplo n.º 1
0
 def delete_auto_scaling_instance_from_group():
     if not OtcConfig.INSTANCE_NAME is None:
         ecs.convertINSTANCENameToId()
     url = "https://" + OtcConfig.DEFAULT_HOST + "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_group_instance/" + OtcConfig.INSTANCE_ID
     ret = utils_http.delete(url)
     print(ret)
     return ret
Ejemplo n.º 2
0
    def delete_backend_member():
        if not (OtcConfig.LISTENER_NAME is None):
            elb.convertLISTENERNameToId()
        if not OtcConfig.INSTANCE_NAME is None:
            ecs.convertINSTANCENameToId() 
			
        url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/listeners/" + OtcConfig.LISTENER_ID + "/members/action"       

        REQ_DELETE_BACKEND_MEMBER=utils_templates.create_request("delete_backend_member")        
   
        ret = utils_http.post(url, REQ_DELETE_BACKEND_MEMBER)
	
        print(ret)
        return ret			
Ejemplo n.º 3
0
    def list_container_instances():
        if OtcConfig.CLUSTER:
            cce.convertClusterNameToId()

        if OtcConfig.INSTANCE_NAME:
            ecs.convertINSTANCENameToId()

        if OtcConfig.INSTANCE_ID:
            url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/clusters/" + OtcConfig.CLUSTER_ID + "/hosts"
            ret = utils_http.get(url)
            ecs.otcOutputHandler().print_output(ret, mainkey="")
        else:
            url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/clusters/" + OtcConfig.CLUSTER_ID + "/hosts/" + OtcConfig.INSTANCE_ID
            ret = utils_http.get(url)
            ecs.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Ejemplo n.º 4
0
    def batch_add_delete_auto_scaling_instances():
        if not (OtcConfig.SCALINGGROUP_NAME is None):
            autoscaling.convertASNameToId()

        if (OtcConfig.INSTANCE_ID is
                None) and not OtcConfig.INSTANCE_NAME is None:
            ecs.convertINSTANCENameToId()

        REQ_BATCH_INST = utils_templates.create_request(
            "batch_remove_add_instance")

        url = "https://" + OtcConfig.DEFAULT_HOST + "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_group_instance/" + OtcConfig.SCALINGGROUP_ID + "/action"
        ret = utils_http.post(url, REQ_BATCH_INST)
        #print(REQ_BATCH_INST)
        autoscaling.otcOutputHandler().print_output(ret, mainkey="")
        return ret