Gandi

Previous topic

RPC Fault Codes

Dry-RunΒΆ

When using a method that creates or updates objects (such as Domains or Shares ), it is possible to test it beforehand in order to avoid mistakes. This is called a dry-run and is triggered by adding the pair '--dry-run': True to the params dict.

# domain.create(apikey, domain, params)
>>> api.domain.create(key, 'my-domain-name.com', {'--dry-run': True})
[{'attr': [],
  'error': 'EC_MISSINGMANDATORY',
  'field': 'admin',
  'field_type': 'Struct',
  'reason': 'missing field admin'},
 {'attr': [],
  'error': 'EC_MISSINGMANDATORY',
  'field': 'owner',
  'field_type': 'Struct',
  'reason': 'missing field owner'},
 {'attr': [],
  'error': 'EC_MISSINGMANDATORY',
  'field': 'duration',
  'field_type': 'Struct',
  'reason': 'missing field duration'},
 {'attr': [],
  'error': 'EC_MISSINGMANDATORY',
  'field': 'bill',
  'field_type': 'Struct',
  'reason': 'missing field bill'},
 {'attr': [],
  'error': 'EC_MISSINGMANDATORY',
  'field': 'tech',
  'field_type': 'Struct',
  'reason': 'missing field tech'}]

The behaviour of the method will be altered by the use of the dry-run parameter. It will execute its usual steps but will not alter any existing information nor will it create any new objects. Instead of the usual return value, the method will return either an empty list or a list of operational errors (each error being a struct).