A joint callback for both "get zone" and "create zone" operations.
342788
private RpcBatch.Callback<ManagedZone> createZoneCallback(
      final DnsOptions serviceOptions,
      final DnsBatchResult<Zone> result,
      final boolean nullForNotFound,
      final boolean idempotent) {
    return new RpcBatch.Callback<ManagedZone>() {
      @Override
      public void onSuccess(ManagedZone response) {
        result.success(
            response == null ? null : Zone.fromPb(serviceOptions.getService(), response));
      }

      @Override
      public void onFailure(GoogleJsonError googleJsonError) {
        DnsException serviceException = new DnsException(googleJsonError, idempotent);
        if (nullForNotFound && serviceException.getCode() == HTTP_NOT_FOUND) {
          result.success(null);
        } else {
          result.error(serviceException);
        }
      }
    };
  }
89123
function performCreate(builder, path, data, callback) {
  var client = builder.client;
  var zk = client.zk;
  var firstTime = true;

  client.retryLoop(exec, callback);

  function exec(cb) {
    if (firstTime && builder.protection) {
      findProtectedNode(builder, path, createIfNotExist);
    }
    else {
      createIfNotExist();
    }

    firstTime = false;

    function createIfNotExist(err, nodePath) {
      if (err) {
        var args = operationArguments(builder, path, data);
        return cb(new ExecutionError('create', args, err));
      }
      else if (nodePath) {
        return cb(null, nodePath);
      }

      zk.create(path, data, builder.acls, builder.mode, afterCreate);
    }

    function afterCreate(err, nodePath) {
      if (nodePath) {
        cb(null, nodePath);
      }
      else if (err.getCode() === Exception.NO_NODE && builder.createParents) {
        utils.mkdirs(zk, path, false, null, createIfNotExist);
      }
      else {
        var args = operationArguments(builder, path, data);
        cb(new ExecutionError('create', args, err));
      }
    }
  }
}
1081849
def cli(env, zone):
    """"""

    manager = SoftLayer.DNSManager(env.client)
    zone_id = helpers.resolve_id(manager.resolve_ids, zone, name='zone')
    env.fout(manager.dump_zone(zone_id))
676353
def _find_zone_by_id(self, zone_id):
        """"""
        if not self.zones:
            return None

        zone = list(filter(
            lambda zone: zone.id == zone_id, self.zones))

        return zone[0] if zone else None
1326473
public void setZones(Map<String, List<URL>> zones) {
        if (zones != null) {
            this.otherZones = zones.entrySet()
                .stream()
                .flatMap((Function<Map.Entry<String, List<URL>>, Stream<ServiceInstance>>) entry ->
                    entry.getValue()
                        .stream()
                        .map(uriMapper())
                        .map(uri ->
                            ServiceInstance.builder(getServiceID(), uri)
                                .zone(entry.getKey())
                                .build()
                        ))
                .collect(Collectors.toList());
        }
    }
903123
def startMultiple(self, zones):
        """"""
        path = 'zone/start_multiple'
        payload = {'zones': zones}
        return self.rachio.put(path, payload)
1000633
function(err, data) {
        var regexp = RegExp(/R(\d)(.*)/);
        var ret;
        var zoneName;

        if (data) {
            for (i = 0; i < data.length; i++) {
                if (ret = regexp.exec(data[i])) {
                    zoneName = data[i].trim().substr(2);
                    zones[zoneIds[parseInt(ret[1], 10)]] = zoneName;
                }
            }
        }
        callback(null, zones);                                                  // whatever happens, we finally go on
    }
1130686
def from_zone(zone):
    ''''''
    validity = zone.validity.start if zone.validity else None
    return build(zone.level, zone.code, validity)
1272892
private void notifyHandler(ZoneHandlerClass handler, ApiZone apiZone, Object userAgent) {
        Object instance = handler.newInstance();
        callHandleMethod(handler.getHandleMethod(), instance, apiZone, userAgent);
    }
896632
def createLinkToSelf(self, new_zone, callback=None, errback=None,
                         **kwargs):
        
        zone = Zone(self.config, new_zone)
        kwargs['link'] = self.data['zone']
        return zone.create(callback=callback, errback=errback, **kwargs)
436395
def _assign_zones(self):
        """"""
        for zone_id in range(1, 5):
            zone = \
                RainCloudyFaucetZone(
                    parent=self._parent,
                    controller=self._controller,
                    faucet=self,
                    zone_id=zone_id)

            if zone not in self.zones:
                self.zones.append(zone)
540309
def enable_zones(self, zones):
        
        if isinstance(zones, str) or isinstance(zones, unicode):
            zones = [zones]
        new_zones = self.connection.enable_availability_zones(self.name, zones)
        self.availability_zones = new_zones
1193677
def set_zone_variable(self, zone_id, variable, value):
        
        return self._send_cmd("SET %s.%s=\"%s\"" % (
            zone_id.device_str(), variable, value))
66496
private RpcBatch.Callback<Change> createChangeRequestCallback(
      final String zoneName,
      final DnsBatchResult<ChangeRequest> result,
      final boolean nullForNotFound,
      final boolean idempotent) {
    return new RpcBatch.Callback<Change>() {
      @Override
      public void onSuccess(Change response) {
        result.success(
            response == null
                ? null
                : ChangeRequest.fromPb(options.getService(), zoneName, response));
      }

      @Override
      public void onFailure(GoogleJsonError googleJsonError) {
        DnsException serviceException = new DnsException(googleJsonError, idempotent);
        if (serviceException.getCode() == HTTP_NOT_FOUND) {
          if ("entity.parameters.changeId".equals(serviceException.getLocation())
              || (serviceException.getMessage() != null
                  && serviceException.getMessage().contains("parameters.changeId"))) {
            // the change id was not found, but the zone exists
            result.success(null);
            return;
          }
          // the zone does not exist, so throw an exception
        }
        result.error(serviceException);
      }
    };
  }
614669
def get_zone(server, token, domain, keyword='', raw_flag=False):
    
    method = 'GET'
    uri = 'https://' + server + '/zone/' + domain
    data = connect.tonicdns_client(uri, method, token, data=False,
                                   keyword=keyword, raw_flag=raw_flag)
    return data
133676
def create_zones(self, add_zones):
        """"""
        for zone, zname in add_zones.items():
            # Name either set explicitly or name of Main Zone with suffix
            zonename = "{} {}".format(self._name, zone) if (
                zname is None) else zname
            zone_inst = DenonAVRZones(self, zone, zonename)
            self._zones[zone] = zone_inst
1112686
def update_pzone(**kwargs):
    """"""

    pzone = PZone.objects.get(**kwargs)

    # get the data and loop through operate_on, applying them if necessary
    when = timezone.now()
    data = pzone.data
    for operation in pzone.operations.filter(when__lte=when, applied=False):
        data = operation.apply(data)
        operation.applied = True
        operation.save()
    pzone.data = data

    # create a history entry
    pzone.history.create(data=pzone.data)

    # save modified pzone, making transactions permanent
    pzone.save()