コード例 #1
0
 def delete_namespace():
     if OtcConfig.CLUSTER:
         cce.convertClusterNameToId()
     url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE
     ret = utils_http.delete(url)
     ecs.otcOutputHandler().print_output(ret, mainkey="")
     return ret
コード例 #2
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
コード例 #3
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)
        ecs.otcOutputHandler().print_output(ret, mainkey="")
        return ret
コード例 #4
0
    def describe_clusters():
        if OtcConfig.CLUSTER:
            cce.convertClusterNameToId()

        if OtcConfig.CLUSTER_ID:
            url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/clusters/" + OtcConfig.CLUSTER_ID
            ret = utils_http.get(url)
            ecs.otcOutputHandler().print_output(ret, mainkey="")
        else:
            return cce.list_clusters()
コード例 #5
0
ファイル: elb.py プロジェクト: kamilstas/python-otcclient
 def describe_health_check():
     if not (OtcConfig.LOADBALANCER_NAME is None):
         elb.convertELBNameToId()
     
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/healthcheck/" + OtcConfig.HEALTHCHECK_ID        
            
     ret = utils_http.get(url)
     
     ecs.otcOutputHandler().print_output(ret,mainkey="")
     return ret
コード例 #6
0
ファイル: elb.py プロジェクト: hajoeichler/python-otcclient
    def describe_listeners():
        if not (OtcConfig.LOADBALANCER_NAME is None):
            elb.convertELBNameToId()

        url = elb.baseurl + "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/listeners" + "?loadbalancer_id=" + OtcConfig.LOADBALANCER_ID

        ret = utils_http.get(url)
        mod = ret.replace("[", "").replace("]", "")
        ecs.otcOutputHandler().print_output(mod, mainkey="")
        return ret
コード例 #7
0
ファイル: elb.py プロジェクト: BuloZB/python-otcclient
 def describe_health_check():
     if not (OtcConfig.LOADBALANCER_NAME is None):
         elb.convertELBNameToId()
     
     url = elb.baseurl+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/healthcheck/" + OtcConfig.HEALTCHECK_ID        
            
     ret = utils_http.get(url)
     
     ecs.otcOutputHandler().print_output(ret,mainkey="")
     return ret
コード例 #8
0
ファイル: elb.py プロジェクト: BuloZB/python-otcclient
    def describe_listeners():
        if not (OtcConfig.LOADBALANCER_NAME is None):
            elb.convertELBNameToId()

        url = elb.baseurl+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/listeners" + "?loadbalancer_id=" + OtcConfig.LOADBALANCER_ID       
               
        ret = utils_http.get(url)
        mod =  ret.replace("[","").replace("]","")        
        ecs.otcOutputHandler().print_output(mod,mainkey="")
        return ret
コード例 #9
0
    def describe_pod_templates():
        if OtcConfig.CLUSTER:
            cce.convertClusterNameToId()

        if OtcConfig.POD:
            url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/podtemplates/" + OtcConfig.POD
        else:
            url = "https://" + OtcConfig.DEFAULT_HOST + "/api/v1/namespaces/" + OtcConfig.NAMESPACE + "/podtemplates"

        ret = utils_http.get(url)
        ecs.otcOutputHandler().print_output(ret, mainkey="")
        return ret
コード例 #10
0
ファイル: elb.py プロジェクト: kamilstas/python-otcclient
 def describe_load_balancers():
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers"        
     if not (OtcConfig.LOADBALANCER_NAME is None):
         elb.convertELBNameToId()
     
     if OtcConfig.LOADBALANCER_ID:
         url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers" + "/" + OtcConfig.LOADBALANCER_ID
         ret = utils_http.get(url)                       
         ecs.otcOutputHandler().print_output(ret,mainkey="")
     else:
         url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers"
         ret = utils_http.get(url) 
         elb.otcOutputHandler().print_output(ret, mainkey="loadbalancers", listkey={"vip_address","update_time","create_time","id","name","status","bandwidth","admin_state_up","type","description" } )
                      
     return ret
コード例 #11
0
ファイル: elb.py プロジェクト: BuloZB/python-otcclient
 def describe_load_balancers():
     url = elb.baseurl+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers"        
     if not (OtcConfig.LOADBALANCER_NAME is None):
         elb.convertELBNameToId()
     
     if OtcConfig.LOADBALANCER_ID:
         url = elb.baseurl+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers" + "/" + OtcConfig.LOADBALANCER_ID
         ret = utils_http.get(url)                       
         ecs.otcOutputHandler().print_output(ret,mainkey="")
     else:
         url = elb.baseurl+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/loadbalancers"
         ret = utils_http.get(url) 
         elb.otcOutputHandler().print_output(ret, mainkey="loadbalancers", listkey={"vip_address","update_time","create_time","id","name","status","bandwidth","admin_state_up","type","description" } )
                      
     return ret
コード例 #12
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
コード例 #13
0
ファイル: elb.py プロジェクト: kamilstas/python-otcclient
 def describe_quotas():
     url = "https://" + OtcConfig.DEFAULT_HOST+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/quotas"                           
     ret = utils_http.get(url)
     print( ret )
     ecs.otcOutputHandler().print_output(ret,mainkey="")
     return ret
コード例 #14
0
ファイル: elb.py プロジェクト: BuloZB/python-otcclient
 def describe_quotas():
     url = elb.baseurl+ "/v1.0/" + OtcConfig.PROJECT_ID + "/elbaas/quotas"                           
     ret = utils_http.get(url)
     print( ret )
     ecs.otcOutputHandler().print_output(ret,mainkey="")
     return ret