Exemplo n.º 1
0
    def build_directive(cls, options):
        required_params = {
            'resource': options.resource,
            'access_type': options.access_type,
            'meters': explode_array(options.meters),
            'step': options.step,
            'start_time': options.start_time,
            'end_time': options.end_time,
        }

        for param in required_params:
            if required_params[param] is None or required_params[param] == '':
                print "param [%s] should be specified" % param
                return None

        directive = {
            "resource": options.resource,
            "access_type": options.access_type,
            "meters": explode_array(options.meters),
            "step": options.step,
            "start_time": options.start_time,
            "end_time": options.end_time,
        }

        if options.interface_name:
            directive['interface_name'] = options.interface_name
        if options.monitor_type:
            directive['monitor_type'] = options.monitor_type
        if options.ha_member_index:
            directive['ha_member_index'] = options.ha_member_index

        return directive
    def build_directive(cls, options):
        if not options.lb_listener:
            print('error: listener should be specified')
            return None

        forwardfor = options.forwardfor
        if forwardfor:
            mapper = {
                    'X_FORWARD_FOR': 1,
                    'QC_LB_ID': 2,
                    'QC_LB_IP': 4,
                    }
            headers = [h for h in explode_array(forwardfor) if h in mapper]
            forwardfor = 0
            for header in headers:
                forwardfor |= mapper[header]

        return {
                'loadbalancer_listener': options.lb_listener,
                'loadbalancer_listener_name': options.lb_listener_name,
                'balance_mode': options.balance_mode,
                'forwardfor': forwardfor,
                'healthy_check_method': options.healthy_check_method,
                'healthy_check_option': options.healthy_check_option,
                'session_sticky': options.session_sticky,
                'server_certificate_id': explode_array(options.server_certificate_id),
                }
    def build_directive(cls, options):
        directive = {
            "group_role_rules": explode_array(options.group_role_rules),
            "group_roles": explode_array(options.group_roles),
        }

        return directive
Exemplo n.º 4
0
    def build_directive(cls, options):
        if not options.lb_listener:
            print('error: listener should be specified')
            return None

        forwardfor = options.forwardfor
        if forwardfor:
            mapper = {
                'X_FORWARD_FOR': 1,
                'QC_LB_ID': 2,
                'QC_LB_IP': 4,
            }
            headers = [h for h in explode_array(forwardfor) if h in mapper]
            forwardfor = 0
            for header in headers:
                forwardfor |= mapper[header]

        return {
            'loadbalancer_listener': options.lb_listener,
            'loadbalancer_listener_name': options.lb_listener_name,
            'balance_mode': options.balance_mode,
            'forwardfor': forwardfor,
            'healthy_check_method': options.healthy_check_method,
            'healthy_check_option': options.healthy_check_option,
            'session_sticky': options.session_sticky,
            'server_certificate_id':
            explode_array(options.server_certificate_id),
        }
Exemplo n.º 5
0
    def build_directive(cls, options):
        directive = {
            "group_role_rules": explode_array(options.group_role_rules),
            "group_roles": explode_array(options.group_roles),
        }

        return directive
Exemplo n.º 6
0
 def build_directive(cls, options):
     return {
             'jobs': explode_array(options.jobs),
             'status': explode_array(options.status),
             'job_action': options.job_action,
             'offset':options.offset,
             'limit': options.limit,
             }
Exemplo n.º 7
0
 def build_directive(cls, options):
     return {
         'jobs': explode_array(options.jobs),
         'status': explode_array(options.status),
         'job_action': options.job_action,
         'offset': options.offset,
         'limit': options.limit,
     }
 def build_directive(cls, options):
     return {
         'security_groups': explode_array(options.security_groups),
         'search_word': options.search_word,
         'verbose': options.verbose,
         'offset': options.offset,
         'limit': options.limit,
         'tags': explode_array(options.tags),
     }
Exemplo n.º 9
0
 def build_directive(cls, options):
     return {
             'keypairs': explode_array(options.keypairs),
             'encrypt_method': explode_array(options.encrypt_method),
             'search_word': options.search_word,
             'verbose': options.verbose,
             'offset':options.offset,
             'limit': options.limit,
             }
Exemplo n.º 10
0
 def build_directive(cls, options):
     return {
             'routers': explode_array(options.routers),
             'status': explode_array(options.status),
             'verbose': options.verbose,
             'search_word': options.search_word,
             'offset':options.offset,
             'limit': options.limit,
             }
Exemplo n.º 11
0
 def build_directive(cls, options):
     return {
             'volumes': explode_array(options.volumes),
             'instance_id': explode_array(options.instance_id),
             'status': explode_array(options.status),
             'search_word': options.search_word,
             'offset':options.offset,
             'limit': options.limit,
             }
Exemplo n.º 12
0
 def build_directive(cls, options):
     directive = {
         "s2_accounts": explode_array(options.s2_accounts),
         "account_types": explode_array(options.account_types),
         "account_name": options.account_name,
         "search_word": options.search_word,
         "verbose": options.verbose,
     }
     
     return directive
Exemplo n.º 13
0
 def build_directive(cls, options):
     return {
             'eips': explode_array(options.eips),
             'status': explode_array(options.status),
             'eip_group': explode_array(options.eip_group),
             'instance_id': options.instance_id,
             'search_word': options.search_word,
             'offset':options.offset,
             'limit': options.limit,
             }
Exemplo n.º 14
0
 def build_directive(cls, options):
     return {
         'nics': explode_array(options.nics),
         'status': explode_array(options.status),
         'nic_name': options.nic_name,
         'vxnets': explode_array(options.vxnets),
         'vxnet_type': explode_array(options.vxnet_type),
         'offset': options.offset,
         'limit': options.limit,
     }
Exemplo n.º 15
0
 def build_directive(cls, options):
     return {
         'volumes': explode_array(options.volumes),
         'instance_id': explode_array(options.instance_id),
         'status': explode_array(options.status),
         'search_word': options.search_word,
         'offset': options.offset,
         'limit': options.limit,
         'tags': explode_array(options.tags),
     }
Exemplo n.º 16
0
    def build_directive(cls, options):
        keypairs = explode_array(options.keypairs)
        instances = explode_array(options.instances)
        if not keypairs or not instances:
            return None

        return {
                'keypairs': keypairs,
                'instances': instances,
                }
Exemplo n.º 17
0
    def build_directive(cls, options):
        directive = {
            "s2_accounts": explode_array(options.s2_accounts),
            "account_types": explode_array(options.account_types),
            "account_name": options.account_name,
            "search_word": options.search_word,
            "verbose": options.verbose,
        }

        return directive
Exemplo n.º 18
0
 def build_directive(cls, options):
     return {
             'vxnets': explode_array(options.vxnets),
             'vxnet_type': options.vxnet_type,
             'search_word': options.search_word,
             'verbose': options.verbose,
             'offset': options.offset,
             'limit': options.limit,
             'tags': explode_array(options.tags),
             }
Exemplo n.º 19
0
    def build_directive(cls, options):
        keypairs = explode_array(options.keypairs)
        instances = explode_array(options.instances)
        if not keypairs or not instances:
            return None

        return {
                'keypairs': keypairs,
                'instances': instances,
                }
Exemplo n.º 20
0
    def build_directive(cls, options):
        instances = explode_array(options.instances)
        if not instances:
            print('error: [instances] should be specified')
            return None

        return {
            'instances': instances,
            'vxnets': explode_array(options.vxnets),
        }
Exemplo n.º 21
0
 def build_directive(cls, options):
     return {
         'nics': explode_array(options.nics),
         'status': explode_array(options.status),
         'nic_name': options.nic_name,
         'vxnets': explode_array(options.vxnets),
         'vxnet_type': explode_array(options.vxnet_type),
         'offset': options.offset,
         'limit': options.limit,
     }
Exemplo n.º 22
0
 def build_directive(cls, options):
     return {
         'vxnets': explode_array(options.vxnets),
         'vxnet_type': options.vxnet_type,
         'search_word': options.search_word,
         'verbose': options.verbose,
         'offset': options.offset,
         'limit': options.limit,
         'tags': explode_array(options.tags),
     }
Exemplo n.º 23
0
 def build_directive(cls, options):
     return {
             'loadbalancers': explode_array(options.loadbalancers),
             'status': explode_array(options.status),
             'verbose': options.verbose,
             'search_word': options.search_word,
             'offset':options.offset,
             'limit': options.limit,
             'tags': explode_array(options.tags),
             }
Exemplo n.º 24
0
 def build_directive(cls, options):
     return {
         'loadbalancers': explode_array(options.loadbalancers),
         'status': explode_array(options.status),
         'verbose': options.verbose,
         'search_word': options.search_word,
         'offset': options.offset,
         'limit': options.limit,
         'tags': explode_array(options.tags),
     }
Exemplo n.º 25
0
    def build_directive(cls, options):
        directive = {
            "s2_groups": explode_array(options.s2_groups),
            "group_types": explode_array(options.group_types),
            "group_name": options.group_name,
            "search_word": options.search_word,
            "verbose": options.verbose,
        }

        return directive
Exemplo n.º 26
0
 def build_directive(cls, options):
     return {
             'keypairs': explode_array(options.keypairs),
             'encrypt_method': explode_array(options.encrypt_method),
             'search_word': options.search_word,
             'verbose': options.verbose,
             'offset':options.offset,
             'limit': options.limit,
             'tags': explode_array(options.tags),
             }
Exemplo n.º 27
0
    def build_directive(cls, options):
        resource_tag_pairs = explode_array(options.resource_tag_pairs, ";")

        for i, p in enumerate(resource_tag_pairs):
            tag_id, resource_type, resource_id = explode_array(p, ":")
            resource_tag_pairs[i] = {"tag_id": tag_id,
                                     "resource_type": resource_type,
                                     "resource_id": resource_id}

        directive = {"resource_tag_pairs": resource_tag_pairs}
        return directive
Exemplo n.º 28
0
    def build_directive(cls, options):
        keypairs = explode_array(options.keypairs)
        instances = explode_array(options.instances)
        if not keypairs or not instances:
            print('note: [keypairs] and [instances] should be specified')
            return None

        return {
            'keypairs': keypairs,
            'instances': instances,
        }
Exemplo n.º 29
0
 def build_directive(cls, options):
     return {
             'instances': explode_array(options.instances),
             'status': explode_array(options.status),
             'image_id': explode_array(options.image_id),
             'instance_type': explode_array(options.instance_type),
             'search_word': options.search_word,
             'verbose': options.verbose,
             'offset':options.offset,
             'limit': options.limit,
             }
Exemplo n.º 30
0
 def build_directive(cls, options):
     return {
             'eips': explode_array(options.eips),
             'status': explode_array(options.status),
             'eip_group': explode_array(options.eip_group),
             'instance_id': options.instance_id,
             'search_word': options.search_word,
             'offset':options.offset,
             'limit': options.limit,
             'tags': explode_array(options.tags),
             }
    def build_directive(cls, options):

        return {
            'instance_groups': explode_array(options.instance_groups),
            'relation': options.relation,
            'tags': explode_array(options.tags),
            'owner': options.owner,
            'verbose': options.verbose,
            'offset': options.offset,
            'limit': options.limit
        }
Exemplo n.º 32
0
 def build_directive(cls, options):
     directive = {
         "s2_servers": explode_array(options.s2_servers),
         "service_types": explode_array(options.service_types),
         "status": explode_array(options.status),
         "search_word": options.search_word,
         "tags": explode_array(options.tags),
         "verbose": options.verbose,
     }
     
     return directive
Exemplo n.º 33
0
 def build_directive(cls, options):
     keypairs = explode_array(options.keypairs)
     instances = explode_array(options.instances)
     if not keypairs or not instances:
         print 'note: [keypairs] and [instances] should be specified'
         return None
         
     return {
             'keypairs': keypairs,
             'instances': instances,
             }
Exemplo n.º 34
0
    def build_directive(cls, options):
        directive = {
            "s2_servers": explode_array(options.s2_servers),
            "service_types": explode_array(options.service_types),
            "status": explode_array(options.status),
            "search_word": options.search_word,
            "tags": explode_array(options.tags),
            "verbose": options.verbose,
        }

        return directive
Exemplo n.º 35
0
 def build_directive(cls, options):
     directive = {
         "shared_targets": explode_array(options.shared_targets),
         "target_types": explode_array(options.target_types),
         "s2_server_id": options.s2_server_id,
         "export_name": options.export_name,
         "search_word": options.search_word,
         "verbose": options.verbose,
     }
     
     return directive
    def build_directive(cls, options):
        directive = {
            "resource_groups": explode_array(options.resource_groups),
            "resources": explode_array(options.resources),
            "verbose": options.verbose,
            "sort_key": options.sort_key,
            "reverse": options.reverse,
            "limit": options.limit,
            "offset": options.offset
        }

        return directive
Exemplo n.º 37
0
 def build_directive(cls, options):
     return {
         'instances': explode_array(options.instances),
         'status': explode_array(options.status),
         'image_id': explode_array(options.image_id),
         'instance_type': explode_array(options.instance_type),
         'search_word': options.search_word,
         'verbose': options.verbose,
         'offset': options.offset,
         'limit': options.limit,
         'tags': explode_array(options.tags),
     }
Exemplo n.º 38
0
 def build_directive(cls, options):
     return {
         'snapshots': explode_array(options.snapshots),
         'snapshot_type': options.snapshot_type,
         'resource_id': options.resource_id,
         'status': explode_array(options.status),
         'search_word': options.search_word,
         'verbose': options.verbose,
         'offset': options.offset,
         'limit': options.limit,
         'tags': explode_array(options.tags),
     }
Exemplo n.º 39
0
    def build_directive(cls, options):
        directive = {
            "resource_groups": explode_array(options.resource_groups),
            "resources": explode_array(options.resources),
            "verbose": options.verbose,
            "sort_key": options.sort_key,
            "reverse": options.reverse,
            "limit": options.limit,
            "offset": options.offset
        }

        return directive
    def build_directive(cls, options):
        for key in ['s2_groups', 's2_accounts']:
            if not hasattr(options, key):
                print("error: [%s] should be specified." % key)
                return None

        directive = {
            "s2_groups": explode_array(options.s2_groups),
            "s2_accounts": explode_array(options.s2_accounts),
        }

        return directive
Exemplo n.º 41
0
    def build_directive(cls, options):
        directive = {
            "alarm_policies": explode_array(options.alarm_policies),
            "alarm_policy_name": options.alarm_policy_name,
            "alarm_policy_type": options.alarm_policy_type,
            "search_word": options.search_word,
            "resource": options.resource,
            "status": explode_array(options.status),
            "verbose": options.verbose,
        }

        return directive
 def build_directive(cls, options):
     for key in ['s2_groups', 's2_accounts']:
         if not hasattr(options, key):
             print("error: [%s] should be specified." % key)
             return None
     
     directive = {
         "s2_groups": explode_array(options.s2_groups),
         "s2_accounts": explode_array(options.s2_accounts),
     }
     
     return directive
Exemplo n.º 43
0
 def build_directive(cls, options):
     return {
             'snapshots': explode_array(options.snapshots),
             'snapshot_type': options.snapshot_type,
             'resource_id': options.resource_id,
             'status': explode_array(options.status),
             'search_word': options.search_word,
             'verbose': options.verbose,
             'offset':options.offset,
             'limit': options.limit,
             'tags': explode_array(options.tags),
             }
Exemplo n.º 44
0
 def build_directive(cls, options):
     directive = {
         "alarm_policies": explode_array(options.alarm_policies),
         "alarm_policy_name": options.alarm_policy_name,
         "alarm_policy_type": options.alarm_policy_type,
         "search_word": options.search_word,
         "resource": options.resource,
         "status": explode_array(options.status),
         "verbose": options.verbose,
     }
     
     return directive
Exemplo n.º 45
0
 def build_directive(cls, options):
     return {
         'images': explode_array(options.images),
         'processor_type': explode_array(options.processor_type),
         'os_family': explode_array(options.os_family),
         'visibility': explode_array(options.visibility),
         'status': explode_array(options.status),
         'provider': options.provider,
         'verbose': options.verbose,
         'search_word': options.search_word,
         'offset': options.offset,
         'limit': options.limit,
     }
Exemplo n.º 46
0
    def build_directive(cls, options):
        resource_tag_pairs = explode_array(options.resource_tag_pairs, ";")

        for i, p in enumerate(resource_tag_pairs):
            tag_id, resource_type, resource_id = explode_array(p, ":")
            resource_tag_pairs[i] = {
                "tag_id": tag_id,
                "resource_type": resource_type,
                "resource_id": resource_id
            }

        directive = {"resource_tag_pairs": resource_tag_pairs}
        return directive
Exemplo n.º 47
0
 def build_directive(cls, options):
     return {
             'images': explode_array(options.images),
             'processor_type': explode_array(options.processor_type),
             'os_family':explode_array(options.os_family),
             'visibility': explode_array(options.visibility),
             'status': explode_array(options.status),
             'provider': options.provider,
             'verbose': options.verbose,
             'search_word': options.search_word,
             'offset':options.offset,
             'limit': options.limit,
             }
    def build_directive(cls, options):
        if options.ru_set == '':
            print('error: ru_set should be specified')
            return None

        directive = {
            "ru_set": json.loads(options.ru_set),
            "resource_groups": explode_array(options.resource_groups),
            "user_groups": explode_array(options.user_groups),
            "group_roles": explode_array(options.group_roles),
        }

        return directive
    def build_directive(cls, options):
        directive = {
            "group_role_rules": explode_array(options.group_role_rules),
            "group_roles": explode_array(options.group_roles),
            "status": explode_array(options.status),
            "verbose": options.verbose,
            "sort_key": options.sort_key,
            "reverse": options.reverse,
            "limit": options.limit,
            "offset": options.offset
        }

        return directive
Exemplo n.º 50
0
    def build_directive(cls, options):
        directive = {
            "user_groups": explode_array(options.user_groups),
            "status": explode_array(options.status),
            "search_word": options.search_word,
            "verbose": options.verbose,
            "sort_key": options.sort_key,
            "reverse": options.reverse,
            "limit": options.limit,
            "offset": options.offset
        }

        return directive
    def build_directive(cls, options):
        directive = {
            "group_role_rules": explode_array(options.group_role_rules),
            "group_roles": explode_array(options.group_roles),
            "status": explode_array(options.status),
            "verbose": options.verbose,
            "sort_key": options.sort_key,
            "reverse": options.reverse,
            "limit": options.limit,
            "offset": options.offset
        }

        return directive
    def build_directive(cls, options):
        if not options.vxnet:
            print('[vxnet] should be provided')
            return None

        return {
            'vxnet': options.vxnet,
            'image': explode_array(options.image),
            'instances': explode_array(options.instances),
            'instance_type': explode_array(options.instance_type),
            'status': explode_array(options.status),
            'offset': options.offset,
            'limit': options.limit,
        }
    def build_directive(cls, options):
        if not options.vxnet:
            print('[vxnet] should be provided')
            return None

        return {
                'vxnet': options.vxnet,
                'image': explode_array(options.image),
                'instances': explode_array(options.instances),
                'instance_type': explode_array(options.instance_type),
                'status': explode_array(options.status),
                'offset':options.offset,
                'limit': options.limit,
                }
    def build_directive(cls, options):
        directive = {
            "user_groups": explode_array(options.user_groups),
            "users": explode_array(options.users),
            "status": explode_array(options.status),
            "search_word": options.search_word,
            "verbose": options.verbose,
            "sort_key": options.sort_key,
            "reverse": options.reverse,
            "limit": options.limit,
            "offset": options.offset
        }

        return directive
Exemplo n.º 55
0
    def build_directive(cls, options):
        instances = explode_array(options.instances)
        if not instances:
            print('error: [instances] should be specified')
            return None

        return {'instances': instances}
Exemplo n.º 56
0
    def build_directive(cls, options):
        vxnets = explode_array(options.vxnets)
        if not vxnets:
            print('[vxnets] should be specified.')
            return None

        return {'vxnets': vxnets}
 def build_directive(cls, options):
     for key in ['shared_target', 'operation']:
         if not hasattr(options, key):
             print("error: [%s] should be specified." % key)
             return None
     
     directive = {
         "shared_target": options.shared_target,
         "operation": options.operation,
         "parameters": explode_array(options.parameters),
         "initiator_names": explode_array(options.initiator_names),
         "s2_group": options.s2_group,
         "export_name": options.export_name,
     }
     
     return directive
Exemplo n.º 58
0
 def build_directive(cls, options):
     vxnets = explode_array(options.vxnets)
     if not vxnets:
         print('[vxnets] should be specified.')
         return None
     
     return {'vxnets': vxnets}
Exemplo n.º 59
0
 def build_directive(cls, options):
     for key in ['s2_server_id', 'export_name', 'target_type']:
         if not hasattr(options, key):
             print("error: [%s] should be specified." % key)
             return None
     
     directive = {
         "s2_server_id": options.s2_server_id,
         "export_name": options.export_name,
         "target_type": options.target_type,
         "description": options.description,
         "volumes": explode_array(options.volumes),
         "initiator_names": explode_array(options.initiator_names),
     }
     
     return directive
Exemplo n.º 60
0
    def build_directive(cls, options):

        required_params = {
                'image_id': options.image_id,
                }
        for param in required_params:
            if required_params[param] is None or required_params[param] == '':
                print 'error: [%s] should be specified' % param
                return None
        if not options.instance_type:
            if not options.cpu or not options.memory:
                print 'error: [instance_type] should be specified or specify both [cpu] and [memory]'
                return None

        return {
                'image_id': options.image_id,
                'instance_type' : options.instance_type,
                'cpu': options.cpu,
                'memory': options.memory,
                'instance_name' : options.instance_name,
                'count' : options.count,
                'vxnets': explode_array(options.vxnets),
                'security_group': options.security_group,
                'login_mode': options.login_mode,
                'login_passwd': options.login_passwd,
                'login_keypair': options.login_keypair,
                }