Submits missing keys to the service
423190
public function submitMissingKeys() {
        if ($this->missing_keys_by_sources == null)
            return;

        $params = array();
        $source_keys = array();
        foreach($this->missing_keys_by_sources as $source => $keys) {
            array_push($source_keys, $source);

            $keys_data = array();
            foreach($keys as $key) {
                /** @var $key TranslationKey */
                $json = array(
                    "key"           => $key->key,
                    "label"         => $key->label,
                    "description"   => $key->description,
                    "locale"        => $key->locale,
                    "level"         => $key->level
                );
                array_push($keys_data, $json);
            }
            array_push($params, array("source" => $source, "keys" => $keys_data));
        }

        $params = \Tr8n\Utils\ArrayUtils::trim($params);
        $this->apiClient()->post('source/register_keys', array("source_keys" => json_encode($params)));
        $this->missing_keys_by_sources = null;

        // All source caches must be reset for all languages, since the keys have changed
        foreach ($this->languages_by_locale as $locale => $language) {
            foreach ($source_keys as $source_key) {
                Cache::delete(Source::cacheKey($source_key, $locale));
            }
        }
    }
445865
function checkParams(params, reqParams) {
    if ( reqParams.length < 1 ) {
      return;
    }

    if ( (_.isEmpty(params) || !params) && (reqParams.length > 0) ) {
      throw new Error('Missing parameters: ' + reqParams.join(', '));
    }

    var paramsKeys = _.keys(params);
  
    _.each(reqParams, function(reqParam) {
      if ( paramsKeys.indexOf(reqParam) === -1 ) {
        throw new Error('Missing parameter: ' + reqParam);
      }
    });
  }
547797
def remove_missing_keys(src_dict, target_dict):
    
    for key in list(target_dict.keys()):
        if key not in src_dict:
            target_dict.pop(key)
453489
def handle_services(changeset):
    """"""
    charms = {}
    for service_name, service in sorted(changeset.bundle['services'].items()):
        # Add the addCharm record if one hasn't been added yet.
        if service['charm'] not in charms:
            record_id = 'addCharm-{}'.format(changeset.next_action())
            changeset.send({
                'id': record_id,
                'method': 'addCharm',
                'args': [service['charm']],
                'requires': [],
            })
            charms[service['charm']] = record_id

        # Add the deploy record for this service.
        record_id = 'deploy-{}'.format(changeset.next_action())
        changeset.send({
            'id': record_id,
            'method': 'deploy',
            'args': [
                '${}'.format(charms[service['charm']]),
                service_name,
                service.get('options', {}),
                service.get('constraints', ''),
                service.get('storage', {}),
            ],
            'requires': [charms[service['charm']]],
        })
        changeset.services_added[service_name] = record_id

        # Expose this service if required.
        if service.get('expose'):
            changeset.send({
                'id': 'expose-{}'.format(changeset.next_action()),
                'method': 'expose',
                'args': ['${}'.format(record_id)],
                'requires': [record_id],
            })

        # Set the annotations for this service.
        if 'annotations' in service:
            changeset.send({
                'id': 'setAnnotations-{}'.format(changeset.next_action()),
                'method': 'setAnnotations',
                'args': [
                    '${}'.format(record_id),
                    'service',
                    service['annotations'],
                ],
                'requires': [record_id],
            })

    return handle_machines
937010
def service_absent(name, namespace='default', **kwargs):
    '''
    
    '''

    ret = {'name': name,
           'changes': {},
           'result': False,
           'comment': ''}

    service = __salt__['kubernetes.show_service'](name, namespace, **kwargs)

    if service is None:
        ret['result'] = True if not __opts__['test'] else None
        ret['comment'] = 'The service does not exist'
        return ret

    if __opts__['test']:
        ret['comment'] = 'The service is going to be deleted'
        ret['result'] = None
        return ret

    res = __salt__['kubernetes.delete_service'](name, namespace, **kwargs)
    if res['code'] == 200:
        ret['result'] = True
        ret['changes'] = {
            'kubernetes.service': {
                'new': 'absent', 'old': 'present'}}
        ret['comment'] = res['message']
    else:
        ret['comment'] = 'Something went wrong, response: {0}'.format(res)

    return ret
916787
def get_missing_services(self, services):
        
        required_services = set(services)
        provided_services = set(self._services.keys())
        missing_services = required_services.difference(provided_services)

        return sorted(missing_services)
921578
def _validate_other_keys(optional, types, missing, validated, data,
                         to_validate):
    """"""
    errors = []
    for key in to_validate:
        value = data[key]
        if key in optional:
            errors.extend(
                _validate_optional_key(
                    key, missing, value, validated, optional))
            continue
        errors.extend(_validate_type_key(key, value, types, validated))
    return errors
1127988
private String getUnavailableServices() {
        StringBuilder missingServices = new StringBuilder();
        if (tokenService.getReference() == null) {
            missingServices.append("tokenService, ");
        }
        if (tokenManager.getReference() == null) {
            missingServices.append("tokenManager, ");
        }
        if (authenticationService.getReference() == null) {
            missingServices.append("authenticationService, ");
        }
        if (authorizationService.getReference() == null) {
            missingServices.append("authorizationService, ");
        }
        if (userRegistry.getReference() == null) {
            missingServices.append("userRegistry, ");
        }
        if (userRegistryService.getReference() == null) {
            missingServices.append("userRegistryService, ");
        }

        if (missingServices.length() == 0) {
            return null;
        } else {
            // Return everything but the last ", "
            return missingServices.substring(0, missingServices.length() - 2);
        }
    }
238266
private void callMissedHitHandler(K key) {
		if (!map.containsKey(key)) {
			if (missedHitHandler == null) {
				throw new RuntimeException("No Missed Hit Handler");
			}

			V v = missedHitHandler.loadForCache(key);
			if (v != null) {
				put(key, v);
			}
		}
	}
95475
def absent(name, protocol=None, service_address=None):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': ''}

    #check if service exists and remove it
    service_check = __salt__['lvs.check_service'](protocol=protocol,
                                                  service_address=service_address)
    if service_check is True:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'LVS Service {0} is present and needs to be removed'.format(name)
            return ret
        service_delete = __salt__['lvs.delete_service'](protocol=protocol,
                                                        service_address=service_address)
        if service_delete is True:
            ret['comment'] = 'LVS Service {0} has been removed'.format(name)
            ret['changes'][name] = 'Absent'
            return ret
        else:
            ret['comment'] = 'LVS Service {0} removed failed({1})'.format(name, service_delete)
            ret['result'] = False
            return ret
    else:
        ret['comment'] = 'LVS Service {0} is not present, so it cannot be removed'.format(name)

    return ret
555420
def keys_recover(cls, fqdn, key):
        """"""
        data = {
            "deleted": False,
        }
        return cls.json_put('%s/domains/%s/keys/%s' % (cls.api_url, fqdn, key),
                            data=json.dumps(data),)
1055757
def _validate_optional_key(key, missing, value, validated, optional):
    """"""
    try:
        validated[key] = optional[key](value)
    except NotValid as ex:
        return ['%r: %s' % (key, arg) for arg in ex.args]
    if key in missing:
        missing.remove(key)
    return []
373440
def purge_service_by_key(self, service_id, key):
		""""""
		content = self._fetch("/service/%s/purge/%s" % (service_id, key), method="POST")
		return self._status(content)
1232041
def respond_to_missing?(method, include_private = false)
      %i[_attributes _embedded _links].each do |target|
        return true if send(target).respond_to?(method, include_private)
      end
      false
    end
10917
def require(*keys)
      permitted_keys.merge keys
      required_keys = keys.to_set
      unless (missing_keys = required_keys - hash_keys).empty?
        error "required #{terms} #{missing_keys.to_a} missing" + postscript
      end
      self
    end
609402
private void checkForCompletion() {
        final String methodName = "checkForCompletion(): ";
        // mark the list complete if that was the last awaited key
        if (actualIndices.isEmpty()) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, methodName + "setting state=COMPLETE");
            state = failedKeys == null
                            ? COMPLETE
                            : COMPLETE_WITH_FAILURES; // state change must be last action
        }
    }
61877
def problems_autocomplete(self, data, text=None, **kwargs):
        ""
        api_path = "/api/v2/problems/autocomplete.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if text:
            api_query.update({
                "text": text,
            })
        return self.call(api_path, query=api_query, method="POST", data=data, **kwargs)