示例#1
0
 def policy_create(cls, sc, name, policy_type, spec, level=0, cooldown=0):
     args = {
         'policy': {
             'name': name,
             'type': policy_type,
             'level': level,
             'cooldown': cooldown,
             'spec': utils.get_spec_content(spec)
         }
     }
     return sc.post(cls.base_url, data=json.dumps(args))
示例#2
0
 def profile_create(cls, sc, name, profile_type, spec, permission):
     args = {
         'profile': {
             'name': name,
             'permission': permission,
             'spec': utils.get_spec_content(spec),
             'type': profile_type,
             'metadata': {}
         }
     }
     return sc.post(cls.base_url, data=json.dumps(args))
示例#3
0
    def profile_create(cls, sc, name, profile_type, spec, permission):
        spec = utils.get_spec_content(spec)
        type_name = spec.get('type', None)
        type_version = spec.get('version', None)
        properties = spec.get('properties', None)
        args = {
            'profile': {
                'name': name,
                'permission': permission,
                'spec': {
		    'version': type_version,
                    'type': type_name,
                    'properties': utils.process_spec(properties)
                },
                'metadata': {}
            }
        }
        return sc.post(cls.base_url, data=json.dumps(args))