def destroy(self, category, extras): """ Deletes the specified security group. """ context = extras['nova_ctx'] security_group = security.retrieve_group(category.term, extras['nova_ctx'].project_id, extras) security.remove_group(security_group, context)
def create(self, entity, extras): """ Creates a security rule. The group to add the rule to must exist. In OCCI-speak this means the mixin must be supplied with the request """ sec_mixin = get_sec_mixin(entity) context = extras['nova_ctx'] security_group = security.retrieve_group(sec_mixin.term, extras['nova_ctx'] .project_id, context) sg_rule = make_sec_rule(entity, security_group['id']) if security_group_rule_exists(security_group, sg_rule): #This rule already exists in group msg = ('This rule already exists in group. %s') %\ str(security_group) raise AttributeError(msg) security.create_rule(sg_rule, context)