Get collection options

    Additional parameters (kwargs) may be passed, they will be proxied to http.query

    CLI Example:

    .. code-block:: bash

        salt '*' solrcloud.collection_get_options collection_name
333721
def collection_get_options(collection_name, **kwargs):
    '''
    
    '''

    cluster = cluster_status(**kwargs)

    options = {
        "collection.configName": cluster["collections"][collection_name]["configName"],
        "router.name": cluster["collections"][collection_name]["router"]["name"],
        "replicationFactor": int(cluster["collections"][collection_name]["replicationFactor"]),
        "maxShardsPerNode": int(cluster["collections"][collection_name]["maxShardsPerNode"]),
        "autoAddReplicas": cluster["collections"][collection_name]["autoAddReplicas"] is True
    }

    if 'rule' in cluster["collections"][collection_name]:
        options['rule'] = cluster["collections"][collection_name]['rule']
    if 'snitch' in cluster["collections"][collection_name]:
        options['snitch'] = cluster["collections"][collection_name]['rule']

    return options
266481
def get_orgs(options = {})
      raise ArgumentError, 'You must provide a :org option' if options[:org].nil? || options[:org].empty?
      options.merge!({:method => 'getOrgs'})
      self.class.get("/", :query => options)
    end
870391
def get_items(self, collection_uri):
        

        cname = os.path.split(collection_uri)[1]
        return self.search_metadata("collection_name:%s" % cname)
866212
def request_args(self):
        """"""
        args = flask.request.args
        data_raw = {}

        for field_name, field in self.args_schema.fields.items():
            alternate_field_name = field.load_from if MA2 else field.data_key

            if alternate_field_name and alternate_field_name in args:
                field_name = alternate_field_name
            elif field_name not in args:
                # getlist will return an empty list instead of raising a
                # KeyError for args that aren't present.
                continue

            value = args.getlist(field_name)
            if not self.is_list_field(field) and len(value) == 1:
                value = value[0]

            data_raw[field_name] = value

        return self.deserialize_args(data_raw)
99919
def _get_args(cls, **kwargs):
        
        csl_args = {
            'style': cls._default_style,
            'locale': cls._default_locale
        }

        if has_request_context():
            parser = FlaskParser(locations=('view_args', 'query'))
            csl_args.update(parser.parse(cls._user_args, request))

        csl_args.update({k: kwargs[k]
                         for k in ('style', 'locale') if k in kwargs})

        try:
            csl_args['style'] = get_style_filepath(csl_args['style'].lower())
        except StyleNotFoundError:
            if has_request_context():
                raise StyleNotFoundRESTError(csl_args['style'])
            raise
        return csl_args
1058726
def item_options(self, **kwargs):
        
        actions = self._item_actions.copy()
        if self._resource.is_singular:
            actions['create'] = ('POST',)
        methods = self._get_handled_methods(actions)
        return self._set_options_headers(methods)
1339853
def _get_options(ret=None):
    '''
    
    '''
    attrs = {
        'api_token': 'api_token',
        'api_url': 'api_url',
        'tags': 'tags',
        'sls_states': 'sls_states'
    }

    _options = salt.returners.get_returner_options(
        __virtualname__,
        ret,
        attrs,
        __salt__=__salt__,
        __opts__=__opts__)

    _options['api_url'] = _options.get('api_url', 'api.appoptics.com')
    _options['sls_states'] = _options.get('sls_states', [])
    _options['tags'] = _options.get('tags', {
        'host_hostname_alias': __salt__['grains.get']('id')
    })

    log.debug('Retrieved appoptics options: %s', _options)
    return _options
966466
public static Option[] getCommonOptions() {
    return new Option[] {
      Option.builder()
              .hasArg()
              .required(false)
              .desc("Batch interval (seconds) for streaming applications; default is 1 second")
              .longOpt("batchInterval")
              .build(),
      Option.builder()
              .hasArg()
              .required(false)
              .desc("The master URL to connect to, such as \"local\" to run locally with one thread, \"local[4]\" to run locally with 4 cores, or \"spark://master:7077\" to run on a Spark standalone cluster.")
              .longOpt("master")
              .build(),
      Option.builder()
              .hasArg()
              .required(false)
              .desc("Address of the Zookeeper ensemble; defaults to: localhost:9983")
              .longOpt("zkHost")
              .build(),
      Option.builder()
              .hasArg()
              .required(false)
              .desc("Name of collection; no default")
              .longOpt("collection")
              .build(),
      Option.builder()
              .hasArg()
              .required(false)
              .desc("Number of docs to queue up on the client before sending to Solr; default is 10")
              .longOpt("batchSize")
              .build(),
      Option.builder()
              .hasArg()
              .required(false)
              .desc("For authenticating to Solr using JAAS, sets the '" + LOGIN_CONFIG_PROP + "' system property.")
              .longOpt("solrJaasAuthConfig")
              .build(),
      Option.builder()
              .hasArg()
              .required(false)
              .desc("For authenticating to Solr using JAAS, sets the 'solr.kerberos.jaas.appname' system property; default is Client")
              .longOpt("solrJaasAppName")
              .build()
    };
  }
859837
def get_collection(self, path, query, **options):
        
        options = self._merge_options(options)
        if options['iterator_type'] == 'items':
            return CollectionPageIterator(self, path, query, options).items()
        if options['iterator_type'] is None:
            return self.get(path, query, **options)
        raise Exception('Unknown value for "iterator_type" option: {}'.format(
            str(options['iterator_type'])))
1122120
def get(self, collection, doc_id, **kwargs):
        

        resp, con_inf = self.transport.send_request(method='GET',
                                                    endpoint='get',
                                                    collection=collection,
                                                    params={'id': doc_id},
                                                    **kwargs)
        if 'doc' in resp and resp['doc']:
            return resp['doc']
        raise NotFoundError
602122
def get_mongo_query_from_arguments(self, reserved_attributes=[]):
        

        query = {}
        for arg in self.request.arguments:
            if arg not in reserved_attributes:
                if len(self.request.arguments.get(arg)) > 1:
                    query["$or"] = []
                    for val in self.request.arguments.get(arg):
                        query["$or"].append({arg: self.get_arg_value_as_type(val)})
                else:
                    query[arg] = self.get_arg_value_as_type(self.request.arguments.get(arg)[0])

        return query
1136364
def query(options, collection_name, num_to_skip,
          num_to_return, query, field_selector, opts, check_keys=False):
    
    data = struct.pack("<I", options)
    data += bson._make_c_string(collection_name)
    data += struct.pack("<i", num_to_skip)
    data += struct.pack("<i", num_to_return)
    encoded = bson.BSON.encode(query, check_keys, opts)
    data += encoded
    max_bson_size = len(encoded)
    if field_selector is not None:
        encoded = bson.BSON.encode(field_selector, False, opts)
        data += encoded
        max_bson_size = max(len(encoded), max_bson_size)
    (request_id, query_message) = __pack_message(2004, data)
    return (request_id, query_message, max_bson_size)
494802
def args_to_search_url(arguments)
      query = if arguments[:query].kind_of? Hash
        #multi-field
        arguments[:query].collect {|field, query_value| fielded_query(query_value, field)}.join(" ")
      elsif arguments[:search_field]
        fielded_query(arguments[:query], arguments[:search_field])
      else
        arguments[:query]
      end

      query_url = base_url + "volumes?q=#{CGI.escape  query}"
      if configuration.api_key
        query_url += "&key=#{configuration.api_key}"
      end

      if arguments[:per_page]
        query_url += "&maxResults=#{arguments[:per_page]}"
      end
      if arguments[:start]
        query_url += "&startIndex=#{arguments[:start]}"
      end

      if arguments[:sort] &&
          (defn = sort_definitions[arguments[:sort]]) &&
          (value = defn[:implementation])
        query_url += "&orderBy=#{CGI.escape(value)}"
      end


      return query_url
    end
1202195
def _options(self):
        
        if self._options_cache is None:
            target_url = self.client.get_url(self._URL_KEY, 'OPTIONS', 'options')
            r = self.client.request('OPTIONS', target_url)
            self._options_cache = r.json()
        return self._options_cache
939008
def index(options = {}, &block)
      respond_with(collection, options,  &block) if stale?(collection, last_modified: collection.maximum(:updated_at))
    end
1280482
def get(self, **options):
        
        sub_query = self.with_limit(1)
        options = QueryOptions(sub_query).replace(batch_size=1)
        for result in sub_query.run(**options):
            return result
        return None
122270
def get_dbcollection_with_es(self, **kwargs):
        
        es_objects = self.get_collection_es()
        db_objects = self.Model.filter_objects(es_objects)
        return db_objects