<commit_before>export function register({ vm, ...props }) {
  return this.registerProxy({
    vmUuid: vm?.uuid,
    ...props,
  })
}

register.permission = 'admin'
register.params = {
  address: {
    type: 'string',
    optional: true,
  },
  vm: {
    type: 'string',
    optional: true,
  },
  name: {
    type: 'string',
    optional: true,
  },
  authenticationToken: {
    type: 'string',
  },
}
register.resolve = {
  vm: ['vm', 'VM', 'administrate'],
}

export async function unregister({ id }) {
  await this.unregisterProxy(id)
}

unregister.permission = 'admin'
unregister.params = {
  id: {
    type: 'string',
  },
}

export function destroy({ id }) {
  return this.destroyProxy(id)
}

destroy.permission = 'admin'
destroy.params = {
  id: {
    type: 'string',
  },
}

export function get({ id }) {
  return this.getProxy(id)
}

get.permission = 'admin'
get.params = {
  id: {
    type: 'string',
  },
}

export function getAll() {
  return this.getAllProxies()
}

getAll.permission = 'admin'

export function update({ id, vm, ...props }) {
  return this.updateProxy(id, {
    vmUuid: vm?.uuid,
    ...props,
  })
}

update.permission = 'admin'
update.params = {
  id: {
    type: 'string',
  },
  address: {
    type: ['string', 'null'],
    optional: true,
  },
  vm: {
    type: ['string', 'null'],
    optional: true,
  },
  name: {
    type: 'string',
    optional: true,
  },
  authenticationToken: {
    type: 'string',
    optional: true,
  },
}
update.resolve = {
  vm: ['vm', 'VM', 'administrate'],
}

export function deploy({ sr }) {
  return this.deployProxy(sr._xapiId)
}

deploy.permission = 'admin'
deploy.params = {
  sr: {
    type: 'string',
  },
}
deploy.resolve = {
  sr: ['sr', 'SR', 'administrate'],
}

export function upgradeAppliance({ id }) {
  return this.upgradeProxyAppliance(id)
}

upgradeAppliance.permission = 'admin'
upgradeAppliance.params = {
  id: {
    type: 'string',
  },
}

export function checkHealth({ id }) {
  return this.checkProxyHealth(id)
}
checkHealth.permission = 'admin'
checkHealth.params = {
  id: {
    type: 'string',
  },
}
<commit_msg>fix(xo-server/proxy): ability to remove proxy VM (#4722)<commit_after>export function register({ vm, ...props }) {
  return this.registerProxy({
    vmUuid: vm?.uuid,
    ...props,
  })
}

register.permission = 'admin'
register.params = {
  address: {
    type: 'string',
    optional: true,
  },
  vm: {
    type: 'string',
    optional: true,
  },
  name: {
    type: 'string',
    optional: true,
  },
  authenticationToken: {
    type: 'string',
  },
}
register.resolve = {
  vm: ['vm', 'VM', 'administrate'],
}

export async function unregister({ id }) {
  await this.unregisterProxy(id)
}

unregister.permission = 'admin'
unregister.params = {
  id: {
    type: 'string',
  },
}

export function destroy({ id }) {
  return this.destroyProxy(id)
}

destroy.permission = 'admin'
destroy.params = {
  id: {
    type: 'string',
  },
}

export function get({ id }) {
  return this.getProxy(id)
}

get.permission = 'admin'
get.params = {
  id: {
    type: 'string',
  },
}

export function getAll() {
  return this.getAllProxies()
}

getAll.permission = 'admin'

export function update({ id, vm, ...props }) {
  return this.updateProxy(id, {
    vmUuid: vm != null ? this.getObject(vm).uuid : vm,
    ...props,
  })
}

update.permission = 'admin'
update.params = {
  id: {
    type: 'string',
  },
  address: {
    type: ['string', 'null'],
    optional: true,
  },
  vm: {
    type: ['string', 'null'],
    optional: true,
  },
  name: {
    type: 'string',
    optional: true,
  },
  authenticationToken: {
    type: 'string',
    optional: true,
  },
}

export function deploy({ sr }) {
  return this.deployProxy(sr._xapiId)
}

deploy.permission = 'admin'
deploy.params = {
  sr: {
    type: 'string',
  },
}
deploy.resolve = {
  sr: ['sr', 'SR', 'administrate'],
}

export function upgradeAppliance({ id }) {
  return this.upgradeProxyAppliance(id)
}

upgradeAppliance.permission = 'admin'
upgradeAppliance.params = {
  id: {
    type: 'string',
  },
}

export function checkHealth({ id }) {
  return this.checkProxyHealth(id)
}
checkHealth.permission = 'admin'
checkHealth.params = {
  id: {
    type: 'string',
  },
}

{'fraction_non_alphanumeric': 0.1759281153937101, 'fraction_numerical': 0.0009458500827618822, 'mean_word_length': 3.063400576368876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6628108', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1503, 'n_words': 334}