Esempio n. 1
0
 def add_nodes():
     REQ_ADD_NODE = utils_templates.create_request("add_node")
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/cluster_infos/" + OtcConfig.CLUSTER_ID
     ret = utils_http.post(url, REQ_ADD_NODE)
     print(url)
     print(ret)
     sahara.otcOutputHandler().print_output(ret, mainkey="")
 def create_jobbinary():
     REQ_ADD_JOBBIN=utils_templates.create_request("create_jobbinary")               
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/job-binaries"
     ret = utils_http.post(url, REQ_ADD_JOBBIN)
     print (url)
     print (ret)        
     sahara.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 3
0
    def create_cluster():        
        url = "https://" + OtcConfig.DEFAULT_HOST + "/rds/v1/"+ OtcConfig.PROJECT_ID +"/instances"
        url = url.replace('iam', 'rds')
        # url = string.replace(url, 'iam', 'rds')
        #vpc_id
        
        if not (OtcConfig.VPCNAME is None):
            getplugin("ecs").convertVPCNameToId()
        
        #network_id
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()

        if (not (OtcConfig.SECUGROUPNAME is None)):
            getplugin("ecs").convertSECUGROUPNameToId()


        if (OtcConfig.DBTYPE is None):
            OtcConfig.DBTYPE = "MySQL"

        if (OtcConfig.DBVERSION is None):
            OtcConfig.DBVERSION = "5.7.20"

        if (OtcConfig.DISK_SIZE is None):
            OtcConfig.DISK_SIZE = 100

        if (OtcConfig.DISK_TYPE is None):
            OtcConfig.DISK_TYPE = "COMMON"

        REQ_CREATE_CLUSTER=utils_templates.create_request("create_cluster")

        ret = utils_http.post(url, REQ_CREATE_CLUSTER)
        print(REQ_CREATE_CLUSTER)
        rds.otcOutputHandler().print_output(ret, mainkey = "")
Esempio n. 4
0
    def modify_auto_scaling_group():
        if (OtcConfig.SCALINGGROUP_ID is None) and not (OtcConfig.SCALINGGROUP_NAME is None):
            autoscaling.convertASNameToId()
        #print(SCALINGGROUP_NAME)
        #vpc_id
        if not (OtcConfig.VPCNAME is None):
            getplugin("ecs").convertVPCNameToId()
        #scaling_configuration_id
        if not (OtcConfig.SCALING_CONFIGURATION_NAME is None):
            autoscaling.convertASConfigurationNameToId()

        #lb_listener_id
        if not (OtcConfig.LISTENER_NAME is None):
            autoscaling.convertLISTENERNameToId()
        #network_id
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()
        #security_group_id
        if not OtcConfig.SECUGROUPNAME is None:
            getplugin("ecs").convertSECUGROUPNameToId()
        #print(OtcConfig.SECUGROUPNAME)
        #print(OtcConfig.SECUGROUP)
        REQ_CREATE_SCG=utils_templates.create_request("modify_as_group")
        url = "https://" + OtcConfig.DEFAULT_HOST+ "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_group/"+ OtcConfig.SCALINGGROUP_ID
        ret = utils_http.put(url, REQ_CREATE_SCG)
        autoscaling.otcOutputHandler().print_output(ret,mainkey="")
        #print(REQ_CREATE_SCG)
        return ret
Esempio n. 5
0
 def add_job():
     REQ_ADD_JOB=utils_templates.create_request("add_job")               
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/jobs/submit-job"
     ret = utils_http.post(url, REQ_ADD_JOB)
     print (url)
     print (ret)        
     mrs.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 6
0
 def add_job():
     REQ_ADD_JOB = utils_templates.create_request("add_job")
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/jobs/submit-job"
     ret = utils_http.post(url, REQ_ADD_JOB)
     print(url)
     print(ret)
     sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 7
0
 def add_nodes():
     REQ_ADD_NODE=utils_templates.create_request("add_node")               
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/cluster_infos/" + OtcConfig.CLUSTER_ID 
     ret = utils_http.post(url, REQ_ADD_NODE)
     print (url)
     print (ret)        
     mrs.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 8
0
 def create_jobbinary():
     REQ_ADD_JOBBIN = utils_templates.create_request("create_jobbinary")
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/job-binaries"
     ret = utils_http.post(url, REQ_ADD_JOBBIN)
     print(url)
     print(ret)
     sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 9
0
    def create_instance():
        if not OtcConfig.VPCNAME is None:
            getplugin("ecs").convertVPCNameToId()
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()
        if not OtcConfig.SECUGROUPNAME is None:
            getplugin("ecs").convertSECUGROUPNameToId()
        if not OtcConfig.AZ is None:
            dcs.convertAZnameToId()
        if OtcConfig.INSTANCE_TYPE_NAME is None:
            OtcConfig.INSTANCE_TYPE_NAME = "OTC_DCS_SINGLE:1"
        if OtcConfig.INSTANCE_NAME is None:
            OtcConfig.INSTANCE_NAME = "dcs"

        (OtcConfig.INSTANCE_DCS_TYPE, OtcConfig.INSTANCE_DCS_SIZE) = str(
            OtcConfig.INSTANCE_TYPE_NAME).split(':')
        REQ_CREATE_DCS = utils_templates.create_request("create_instance")
        #print (REQ_CREATE_DCS)

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.0/" + OtcConfig.PROJECT_ID + "/instances"
        url = url.replace('iam', 'dcs')
        #print (url)
        ret = utils_http.post(url, REQ_CREATE_DCS)

        print(ret)

        return ret
Esempio n. 10
0
    def create_instance():
        if not OtcConfig.VPCNAME is None:
            getplugin("ecs").convertVPCNameToId()
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()
        if not OtcConfig.SECUGROUPNAME is None:
            getplugin("ecs").convertSECUGROUPNameToId()
        if not OtcConfig.AZ is None:
            dcs.convertAZnameToId()
        if OtcConfig.INSTANCE_TYPE_NAME is None:
            OtcConfig.INSTANCE_TYPE_NAME = "OTC_DCS_SINGLE:1"
        if OtcConfig.INSTANCE_NAME is None:
           OtcConfig.INSTANCE_NAME = "dcs"

        (OtcConfig.INSTANCE_DCS_TYPE,OtcConfig.INSTANCE_DCS_SIZE) = str(OtcConfig.INSTANCE_TYPE_NAME).split(':')
        REQ_CREATE_DCS=utils_templates.create_request("create_instance")
        #print (REQ_CREATE_DCS)

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.0/" + OtcConfig.PROJECT_ID +  "/instances"
        url = url.replace('iam', 'dcs')
        #print (url)
        ret = utils_http.post(url, REQ_CREATE_DCS )

        print (ret)

        return ret
Esempio n. 11
0
 def create_auto_scaling_policy():
     if not (OtcConfig.SCALINGGROUP_NAME is None):
         autoscaling.convertASNameToId()
     REQ_CREATE_SCP=utils_templates.create_request("create_as_policy")
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_policy"
     ret = utils_http.post(url, REQ_CREATE_SCP)
     autoscaling.otcOutputHandler().print_output(ret,mainkey="")
     return ret
Esempio n. 12
0
    def create_datasource():
        REQ_ADD_NODE = utils_templates.create_request("create_datasource")
        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/data-sources"
        ret = utils_http.post(url, REQ_ADD_NODE)

        print(url)
        print(ret)
        sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 13
0
 def create_datasource():        
     REQ_ADD_NODE=utils_templates.create_request("create_datasource")                       
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/data-sources"
     ret = utils_http.post(url, REQ_ADD_NODE)
     
     print (url)
     print (ret)        
     sahara.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 14
0
    def update_jobobject():               
        if not (OtcConfig.JOB is None):
            getplugin("sahara").convertJOBNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/jobs/" + OtcConfig.JOB_ID               
        REQ_UPDADTE_JOBOBJECT=utils_templates.create_request("update_jobobject")
        ret = utils_http.patch(url, REQ_UPDADTE_JOBOBJECT)
        sahara.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 15
0
 def rename_namespace():
     if OtcConfig.CLUSTER:
         cce.convertClusterNameToId()         
     url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces"
     req = utils_templates.create_request("cce_rename_namespace")        
     ret = utils_http.post(url, req)
     cce.otcOutputHandler().print_output(ret,mainkey="")     
     return ret
Esempio n. 16
0
 def rename_namespace():
     if OtcConfig.CLUSTER:
         cce.convertClusterNameToId()
     url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces"
     req = utils_templates.create_request("cce_rename_namespace")
     ret = utils_http.post(url, req)
     ecs.otcOutputHandler().print_output(ret, mainkey="")
     return ret
Esempio n. 17
0
    def update_jobobject():
        if not (OtcConfig.JOB is None):
            getplugin("sahara").convertJOBNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/jobs/" + OtcConfig.JOB_ID
        REQ_UPDADTE_JOBOBJECT = utils_templates.create_request(
            "update_jobobject")
        ret = utils_http.patch(url, REQ_UPDADTE_JOBOBJECT)
        sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 18
0
    def modify_service():
        if OtcConfig.CLUSTER:
            cce.convertClusterNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/services/" + OtcConfig.SERVICE_NAME
        req = utils_templates.create_request("cce_create_service")
        ret = utils_http.put(url, req)
        cce.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Esempio n. 19
0
 def create_jobobject():
     REQ_ADD_JOB = utils_templates.create_request("create_jobobject")
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/jobs"
     ret = utils_http.post(url, REQ_ADD_JOB)
     if OtcConfig.DEBUG:
         print REQ_ADD_JOB
     #print (url)
     #print (ret)
     sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 20
0
 def modify_service():
     if OtcConfig.CLUSTER:
         cce.convertClusterNameToId()
              
     url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/services/" + OtcConfig.SERVICE_NAME
     req = utils_templates.create_request("cce_create_service")
     ret = utils_http.put(url, req)
     cce.otcOutputHandler().print_output(ret,mainkey="")     
     return ret
Esempio n. 21
0
 def create_jobobject():
     REQ_ADD_JOB=utils_templates.create_request("create_jobobject")               
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/jobs"
     ret = utils_http.post(url, REQ_ADD_JOB)
     if OtcConfig.DEBUG:
         print(REQ_ADD_JOB)
     #print (url)
     #print (ret)        
     sahara.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 22
0
 def execute_auto_scaling_policy():
     if not (OtcConfig.SCALING_POLICY_NAME is None):
         autoscaling.convertASPolicyNameToId()
     OtcConfig.AS_POLICY_ACTION="execute"
     REQ_ACTION_SCP=utils_templates.create_request("execute_enable_disable_as_policy")
     url = "https://" + OtcConfig.DEFAULT_HOST + "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_policy/" + OtcConfig.SCALING_POLICY_ID  + "/action"
     ret = utils_http.post(url, REQ_ACTION_SCP)
     autoscaling.otcOutputHandler().print_output(ret,mainkey="")
     return ret
Esempio n. 23
0
 def disable_auto_scaling_group():
     if not (OtcConfig.SCALINGGROUP_NAME is None):
         autoscaling.convertASNameToId()
     OtcConfig.ACTION_DISABLE_ENABLE_AS_GROUP="pause"
     REQ_ACTION_SCG=utils_templates.create_request("disable_enable_as_group")
     url = "https://" + OtcConfig.DEFAULT_HOST + "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_group/" + OtcConfig.SCALINGGROUP_ID + "/action"
     ret = utils_http.post(url, REQ_ACTION_SCG)
     autoscaling.otcOutputHandler().print_output(ret,mainkey="")
     return ret
Esempio n. 24
0
 def add_node():
     #vpc_id
     if not (OtcConfig.CLUSTER is None):
         getplugin("cce").convertClusterNameToId()
                        
     url = "https://cce.eu-de.otc.t-systems.com" + "/api/v1/clusters/" + OtcConfig.CLUSTER_ID  + "/hosts"
     req = utils_templates.create_request("cce_add_node")
     ret = utils_http.post(url, req)
     cce.otcOutputHandler().print_output(ret,mainkey="")     
     return ret
Esempio n. 25
0
 def modify_rc():
     if OtcConfig.CLUSTER:
         cce.convertClusterNameToId()            
     
     url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/replicationcontrollers/" + OtcConfig.RC_NAME
     req = utils_templates.create_request("cce_create_rc")
     #print(req)
     ret = utils_http.put(url, req)
     cce.otcOutputHandler().print_output(ret,mainkey="")    
     return ret
Esempio n. 26
0
    def create_health_check():
        if not (OtcConfig.LISTENER_NAME is None):
            elb.convertLISTENERNameToId()
        
        url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/healthcheck"       

        REQ_CREATE_HEALTH_CHECK=utils_templates.create_request("creating_health_check_task")        
   
        ret = utils_http.post(url, REQ_CREATE_HEALTH_CHECK)
        return ret
Esempio n. 27
0
    def create_endpoint():
        if OtcConfig.CLUSTER:
            cce.convertClusterNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/endpoints"
        req = utils_templates.create_request("cce_create_endpoint")
        print req
        ret = utils_http.post(url, req)
        cce.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Esempio n. 28
0
    def batch_delete_auto_scaling_configuration():
        if (OtcConfig.SCALING_CONFIGURATION_ID is None) and not (OtcConfig.SCALING_CONFIGURATION_NAME is None):
            autoscaling.convertASConfigurationNameToId()

        REQ_DELETE_BATCH_SC=utils_templates.create_request("batch_delete_AS_config")
        url = "https://" + OtcConfig.DEFAULT_HOST + "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_configurations"
        ret = utils_http.post(url, REQ_DELETE_BATCH_SC)
        autoscaling.otcOutputHandler().print_output(ret,mainkey="")
        #print(REQ_DELETE_BATCH_SC)
        return ret
Esempio n. 29
0
    def add_node():
        #vpc_id
        if not (OtcConfig.CLUSTER is None):
            getplugin("cce").convertClusterNameToId()

        url = "https://cce.eu-de.otc.t-systems.com" + "/api/v1/clusters/" + OtcConfig.CLUSTER_ID + "/hosts"
        req = utils_templates.create_request("cce_add_node")
        ret = utils_http.post(url, req)
        cce.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Esempio n. 30
0
    def create_health_check():
        if not (OtcConfig.LISTENER_NAME is None):
            elb.convertLISTENERNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/healthcheck"

        REQ_CREATE_HEALTH_CHECK=utils_templates.create_request("creating_health_check_task")

        ret = utils_http.post(url, REQ_CREATE_HEALTH_CHECK)
        return ret
Esempio n. 31
0
 def create_backend_member():
     if not (OtcConfig.LISTENER_NAME is None):
         elb.convertLISTENERNameToId()
     if not OtcConfig.INSTANCE_NAME is None:
         getplugin("ecs").convertINSTANCENameToId()
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/listeners/" + OtcConfig.LISTENER_ID + "/members"
     REQ_CREATE_BACKEND_MEMBER = utils_templates.create_request("add_backend_member")
     ret = utils_http.post(url, REQ_CREATE_BACKEND_MEMBER)
     print(ret)
     return ret
Esempio n. 32
0
    def modify_rc():
        if OtcConfig.CLUSTER:
            cce.convertClusterNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/replicationcontrollers/" + OtcConfig.RC_NAME
        req = utils_templates.create_request("cce_create_rc")
        #print req
        ret = utils_http.put(url, req)
        cce.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Esempio n. 33
0
 def create_auto_scaling_configuration():
     if not OtcConfig.INSTANCE_TYPE_NAME is None:
         getplugin("ecs").convertFlavorNameToId()
     if not OtcConfig.IMAGENAME is None:
         getplugin("ecs").convertIMAGENameToId()
     REQ_CREATE_SC=utils_templates.create_request("create_as_configuration")
     #print(REQ_CREATE_SC)
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/autoscaling-api/v1/" + OtcConfig.PROJECT_ID + "/scaling_configuration"
     ret = utils_http.post(url, REQ_CREATE_SC)
     autoscaling.otcOutputHandler().print_output(ret,mainkey="")
     return ret
Esempio n. 34
0
 def create_backend_member():
     if not (OtcConfig.LISTENER_NAME is None):
         elb.convertLISTENERNameToId()
     if not OtcConfig.INSTANCE_NAME is None:
         getplugin("ecs").convertINSTANCENameToId()
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/listeners/" + OtcConfig.LISTENER_ID + "/members"
     REQ_CREATE_BACKEND_MEMBER = utils_templates.create_request(
         "add_backend_member")
     ret = utils_http.post(url, REQ_CREATE_BACKEND_MEMBER)
     print(ret)
     return ret
Esempio n. 35
0
    def update_jobbinary():               
        if not (OtcConfig.JOBBINARY is None):
            getplugin("sahara").convertJOBBINARYNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/job-binaries/" + OtcConfig.JOBBINARY_ID
                  
        REQ_UPDADTE_JOBBINARY=utils_templates.create_request("update_jobbinary")
        ret = utils_http.put(url, REQ_UPDADTE_JOBBINARY)
        print (url)
        print (ret)        
        sahara.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 36
0
    def modify_health_check():
        if not (OtcConfig.LISTENER_NAME is None):
            elb.convertLISTENERNameToId()
        
        url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/healthcheck/"  + OtcConfig.HEALTHCHECK_ID              

        REQ_MODIFY_HEALTH_CHECK=utils_templates.create_request("modify_information_health_check_task")        
   
        ret = utils_http.put(url, REQ_MODIFY_HEALTH_CHECK)
        print(ret)
        return ret
Esempio n. 37
0
    def update_jobbinary():
        if not (OtcConfig.JOBBINARY is None):
            getplugin("sahara").convertJOBBINARYNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/job-binaries/" + OtcConfig.JOBBINARY_ID

        REQ_UPDADTE_JOBBINARY = utils_templates.create_request(
            "update_jobbinary")
        ret = utils_http.put(url, REQ_UPDADTE_JOBBINARY)
        print(url)
        print(ret)
        sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 38
0
 def add_as():
     if not (OtcConfig.CLUSTER is None):
         getplugin("mrs").convertCLUSTERNameToId()
      
     url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/autoscaling-policy/" + OtcConfig.CLUSTER_ID         
     url = url.replace("iam", "mrs")
                                             
     REQ_ADD_NODE=utils_templates.create_request("add_as")               
      
     ret = utils_http.post(url, REQ_ADD_NODE)
     print (url)
     print (ret)        
     mrs.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 39
0
    def execute_jobobject():

        if not (OtcConfig.JOB is None):
            getplugin("sahara").convertJOBNameToId()
        REQ_EXECUTE=utils_templates.create_request("execute_jobobject")                       
        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/jobs/" + OtcConfig.JOB_ID +"/execute"
        ret = utils_http.post(url, REQ_EXECUTE)
        if OtcConfig.DEBUG:        
            print(REQ_EXECUTE)
            print (url)
            print (ret)        
        sahara.otcOutputHandler().print_output(ret, mainkey = "")     
        return ret
Esempio n. 40
0
    def restart_instance():
        OtcConfig.DCS_ACTION = "restart"
        REQ_UPDATE_DCS = utils_templates.create_request("update_instance")
        #print (REQ_UPDATE_DCS)

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.0/" + OtcConfig.PROJECT_ID + "/instances/status"
        url = url.replace('iam', 'dcs')
        #print (url)
        ret = utils_http.put(url, REQ_UPDATE_DCS)

        #print (ret)

        return ret
Esempio n. 41
0
    def restart_instance():
        OtcConfig.DCS_ACTION = "restart"
        REQ_UPDATE_DCS=utils_templates.create_request("update_instance")
        #print (REQ_UPDATE_DCS)

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.0/" + OtcConfig.PROJECT_ID +  "/instances/status"
        url = url.replace('iam', 'dcs')
        #print (url)
        ret = utils_http.put(url, REQ_UPDATE_DCS )

        #print (ret)

        return ret
Esempio n. 42
0
    def add_as():
        if not (OtcConfig.CLUSTER is None):
            getplugin("mrs").convertCLUSTERNameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/autoscaling-policy/" + OtcConfig.CLUSTER_ID
        url = url.replace("iam", "mrs")

        REQ_ADD_NODE = utils_templates.create_request("add_as")

        ret = utils_http.post(url, REQ_ADD_NODE)
        print(url)
        print(ret)
        mrs.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 43
0
    def modify_health_check():
        if not (OtcConfig.LOADBALANCER_NAME is None):
            elb.convertELBNameToId()
        if not (OtcConfig.HEALTHCHECK_ID is None):
            elb.convertLISTENERIdToHealthCheckId()

        url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/healthcheck/"  + OtcConfig.HEALTHCHECK_ID

        REQ_MODIFY_HEALTH_CHECK=utils_templates.create_request("modify_information_health_check_task")

        ret = utils_http.put(url, REQ_MODIFY_HEALTH_CHECK)
        print(ret)
        return ret
Esempio n. 44
0
    def execute_jobobject():

        if not (OtcConfig.JOB is None):
            getplugin("sahara").convertJOBNameToId()
        REQ_EXECUTE = utils_templates.create_request("execute_jobobject")
        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/jobs/" + OtcConfig.JOB_ID + "/execute"
        ret = utils_http.post(url, REQ_EXECUTE)
        if OtcConfig.DEBUG:
            print REQ_EXECUTE
            print(url)
            print(ret)
        sahara.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Esempio n. 45
0
    def create_cluster():
        #vpc_id
        if not (OtcConfig.VPCNAME is None):
            getplugin("ecs").convertVPCNameToId()

        #network_id
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()
        url = "https://cce.eu-de.otc.t-systems.com" + "/api/v1/clusters"
        req = utils_templates.create_request("cce_create_cluster")

        ret = utils_http.post(url, req)
        cce.otcOutputHandler().print_output(ret, mainkey="")
        return ret
Esempio n. 46
0
    def create_cluster():
        #vpc_id
        if not (OtcConfig.VPCNAME is None):
            getplugin("ecs").convertVPCNameToId()
                  
        #network_id
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()
        url = "https://cce.eu-de.otc.t-systems.com" + "/api/v1/clusters"
        req = utils_templates.create_request("cce_create_cluster")

        ret = utils_http.post(url, req)         
        cce.otcOutputHandler().print_output(ret,mainkey="")     
        return ret
Esempio n. 47
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:
            getplugin("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
Esempio n. 48
0
 def resize_instance():        
     if not OtcConfig.INSTANCE_NAME is None:
         ecs.convertINSTANCENameToId() 
     if not OtcConfig.INSTANCE_TYPE_NAME is None:
         ecs.convertFlavorNameToId()
     
     if OtcConfig.INSTANCE_ID is None :
         raise RuntimeError( "Error. Must be specify the Instance Name or ID!")
  
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1/" + OtcConfig.PROJECT_ID + "/cloudservers/" + OtcConfig.INSTANCE_ID + "/resize"
     req = utils_templates.create_request("ecs_resize")
     ret = utils_http.post(url, req)
     print(ret)
     return ret
Esempio n. 49
0
    def update_datasource():

        if not (OtcConfig.DATASOURCE_ID is None):
            getplugin("sahara").convertDATASOURCENameToId()

        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/" + OtcConfig.PROJECT_ID + "/data-sources/" + OtcConfig.DATASOURCE_ID

        REQ_UPDADTE_DATASORCE = utils_templates.create_request(
            "update_datasource")

        ret = utils_http.put(url, REQ_UPDADTE_DATASORCE)
        print REQ_UPDADTE_DATASORCE
        print(url)
        print(ret)
        sahara.otcOutputHandler().print_output(ret, mainkey="")
Esempio n. 50
0
    def update_datasource():
                       
        if not (OtcConfig.DATASOURCE_ID is None):
            getplugin("sahara").convertDATASOURCENameToId()
        
        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/data-sources/" + OtcConfig.DATASOURCE_ID
          
        
        REQ_UPDADTE_DATASORCE=utils_templates.create_request("update_datasource")

        ret = utils_http.put(url, REQ_UPDADTE_DATASORCE)
        print(REQ_UPDADTE_DATASORCE)
        print (url)
        print (ret)        
        sahara.otcOutputHandler().print_output(ret, mainkey = "") 
Esempio n. 51
0
    def create_load_balancers():
        if not (OtcConfig.LOADBALANCER_NAME is None):
            elb.convertELBNameToId()
        if not (OtcConfig.VPCNAME is None):
            getplugin("ecs").convertVPCNameToId()
        REQ_CREATE_ELB=utils_templates.create_request("create_loadbalancer")
        url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers"
        ret = utils_http.post(url, REQ_CREATE_ELB)

        maindata = json.loads(ret)
        if "code" in  maindata:
            print("Can not create:" +maindata["message"])
            os._exit( 1 )
        print("created")
        return ret
Esempio n. 52
0
    def create_cluster():               
        url = "https://" + OtcConfig.DEFAULT_HOST + "/v1.1/"+ OtcConfig.PROJECT_ID +"/run-job-flow"
        #vpc_id
        if not (OtcConfig.VPCNAME is None):
            getplugin("ecs").convertVPCNameToId()
          
        #network_id
        if not OtcConfig.SUBNETNAME is None:
            getplugin("ecs").convertSUBNETNameToId()

        
        REQ_CREATE_CLUSTER=utils_templates.create_request("create_cluster_with_job")

        ret = utils_http.post(url, REQ_CREATE_CLUSTER)
        print(REQ_CREATE_CLUSTER)
        print (url)
        print (ret)        
        mrs.otcOutputHandler().print_output(ret, mainkey = "")