o ckF[]@sDddlZddlZddlmZddlmZddZGdddeZdS)N)AWSQueryConnection) RegionInfocCs|dvrdSdS)N)T1truerfalse)valrr9/usr/lib/python3/dist-packages/boto/cloudsearch/layer1.pydo_bool sr c@s eZdZdZejdddZejdddZ     dddZ ddZddZddZddZd d!Zd?d"d#Zd?d$d%Zd?d&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;ZdS)@Layer1z 2011-02-01Botocs_region_namez us-east-1cs_region_endpointz#cloudsearch.us-east-1.amazonaws.comNTr/cCsP| s t||j|j} | |_tj|f|jj|||||||| | | | |||ddS)N)hostaws_access_key_idaws_secret_access_key is_secureportproxy proxy_port proxy_user proxy_passdebughttps_connection_factorypathsecurity_tokenvalidate_certs profile_name)rDefaultRegionNameDefaultRegionEndpointregionr__init__endpoint)selfrrrrrrrrrrrr"r api_versionrrrrrr r#+s0 zLayer1.__init__cCsdgS)Nzhmac-v4r)r%rrr _required_auth_capabilityHsz Layer1._required_auth_capabilityGETcCs|s|}|||||}|} tj| |jdkrWtjj|r"|nddd} tj| |} | | | } |D]} | | } q7| sI|durGdSgSt | t rP| St di| S||j|j| )NSetT) list_markerpythonize_namer) make_requestreadbotologrstatus jsonresponseElement XmlHandlerparseget isinstancelistdict ResponseErrorreason)r%doc_pathactionparamsrparentverbr+responsebodyehinnerprrr get_responseKs*      zLayer1.get_responsecCd}d|i}|j|d|ddS)a: Create a new search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, LimitExceededException )create_domain_responsecreate_domain_result domain_status DomainName CreateDomainPOSTr@rGr% domain_namer<r>rrr create_domaind zLayer1.create_domainFc Csd} |||d} |dkr#|| d<t|| d<t|| d<t|| d<n|dkr,|| d <n|d kr@|| d <t|| d <t|| d <|j| d| ddS)a Defines an ``IndexField``, either replacing an existing definition or creating a new one. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type field_name: string :param field_name: The name of a field in the search index. :type field_type: string :param field_type: The type of field. Valid values are uint | literal | text :type default: string or int :param default: The default value for the field. If the field is of type ``uint`` this should be an integer value. Otherwise, it's a string. :type facet: bool :param facet: A boolean to indicate whether facets are enabled for this field or not. Does not apply to fields of type ``uint``. :type results: bool :param results: A boolean to indicate whether values of this field can be returned in search results or used in ranking. Does not apply to fields of type ``uint``. :type searchable: bool :param searchable: A boolean to indicate whether search is enabled for this field or not. Applies only to fields of type ``literal``. :type source_attributes: list of dicts :param source_attributes: An optional list of dicts that provide information about attributes for this index field. A maximum of 20 source attributes can be configured for each index field. Each item in the list is a dict with the following keys: * data_copy - The value is a dict with the following keys: * default - Optional default value if the source attribute is not specified in a document. * name - The name of the document source field to add to this ``IndexField``. * data_function - Identifies the transformation to apply when copying data from a source attribute. * data_map - The value is a dict with the following keys: * cases - A dict that translates source field values to custom values. * default - An optional default value to use if the source attribute is not specified in a document. * name - the name of the document source field to add to this ``IndexField`` * data_trim_title - Trims common title words from a source document attribute when populating an ``IndexField``. This can be used to create an ``IndexField`` you can use for sorting. The value is a dict with the following fields: * default - An optional default value. * language - an IETF RFC 4646 language code. * separator - The separator that follows the text to trim. * name - The name of the document source field to add. :raises: BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException )define_index_field_responsedefine_index_field_result index_field)rLzIndexField.IndexFieldNamezIndexField.IndexFieldTypeliteralz&IndexField.LiteralOptions.DefaultValuez&IndexField.LiteralOptions.FacetEnabledz'IndexField.LiteralOptions.ResultEnabledz'IndexField.LiteralOptions.SearchEnableduintz#IndexField.UIntOptions.DefaultValuetextz#IndexField.TextOptions.DefaultValuez#IndexField.TextOptions.FacetEnabledz$IndexField.TextOptions.ResultEnabledDefineIndexFieldrNrO)r rG) r%rR field_name field_typedefaultfacetresult searchablesource_attributesr<r>rrr define_index_fieldzs&N     zLayer1.define_index_fieldcCs"d}|||d}|j|d|ddS)a Defines a RankExpression, either replacing an existing definition or creating a new one. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type rank_name: string :param rank_name: The name of an expression computed for ranking while processing a search request. :type rank_expression: string :param rank_expression: The expression to evaluate for ranking or thresholding while processing a search request. The RankExpression syntax is based on JavaScript expressions and supports: * Integer, floating point, hex and octal literals * Shortcut evaluation of logical operators such that an expression a || b evaluates to the value a if a is true without evaluting b at all * JavaScript order of precedence for operators * Arithmetic operators: + - * / % * Boolean operators (including the ternary operator) * Bitwise operators * Comparison operators * Common mathematic functions: abs ceil erf exp floor lgamma ln log2 log10 max min sqrt pow * Trigonometric library functions: acosh acos asinh asin atanh atan cosh cos sinh sin tanh tan * Random generation of a number between 0 and 1: rand * Current time in epoch: time * The min max functions that operate on a variable argument list Intermediate results are calculated as double precision floating point values. The final return value of a RankExpression is automatically converted from floating point to a 32-bit unsigned integer by rounding to the nearest integer, with a natural floor of 0 and a ceiling of max(uint32_t), 4294967295. Mathematical errors such as dividing by 0 will fail during evaluation and return a value of 0. The source data for a RankExpression can be the name of an IndexField of type uint, another RankExpression or the reserved name text_relevance. The text_relevance source is defined to return an integer from 0 to 1000 (inclusive) to indicate how relevant a document is to the search request, taking into account repetition of search terms in the document and proximity of search terms to each other in each matching IndexField in the document. For more information about using rank expressions to customize ranking, see the Amazon CloudSearch Developer Guide. :raises: BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException )define_rank_expression_responsedefine_rank_expression_resultrank_expression)rLzRankExpression.RankExpressionzRankExpression.RankNameDefineRankExpressionrNrOrP)r%rR rank_namergr<r>rrr define_rank_expressionsBzLayer1.define_rank_expressioncCrH)a Delete a search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException )delete_domain_responsedelete_domain_resultrKrL DeleteDomainrNrOrPrQrrr delete_domain(rTzLayer1.delete_domaincC d}||d}|j|d|ddS)a6 Deletes an existing ``IndexField`` from the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type field_name: string :param field_name: A string that represents the name of an index field. Field names must begin with a letter and can contain the following characters: a-z (lowercase), 0-9, and _ (underscore). Uppercase letters and hyphens are not allowed. The names "body", "docid", and "text_relevance" are reserved and cannot be specified as field or rank expression names. :raises: BaseException, InternalException, ResourceNotFoundException )delete_index_field_responsedelete_index_field_resultrX)rLIndexFieldNameDeleteIndexFieldrNrOrP)r%rRr]r<r>rrr delete_index_field>zLayer1.delete_index_fieldcCro)a Deletes an existing ``RankExpression`` from the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type rank_name: string :param rank_name: Name of the ``RankExpression`` to delete. :raises: BaseException, InternalException, ResourceNotFoundException )delete_rank_expression_responsedelete_rank_expression_resultrg)rLRankNameDeleteRankExpressionrNrOrP)r%rRrir<r>rrr delete_rank_expression^s  zLayer1.delete_rank_expressioncCrH)a Describes options defining the default search field used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, ResourceNotFoundException )&describe_default_search_field_response$describe_default_search_field_resultdefault_search_fieldrLDescribeDefaultSearchFieldrNrOrPrQrrr describe_default_search_fieldw z$Layer1.describe_default_search_fieldcCs@d}i}|rt|dD] \}}||d|<q |j|d|dddS)a Describes the domains (optionally limited to one or more domains by name) owned by this account. :type domain_names: list :param domain_names: Limits the response to the specified domains. :raises: BaseException, InternalException )describe_domains_responsedescribe_domains_resultdomain_status_listrzDomainNames.member.%dDescribeDomainsrNDomainStatusListr@r+ enumeraterG)r% domain_namesr<r>irRrrr describe_domainss zLayer1.describe_domainscCDd}d|i}|rt|dD] \}}||d|<q |j|d|dddS) a Describes index fields in the search domain, optionally limited to a single ``IndexField``. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type field_names: list :param field_names: Limits the response to the specified fields. :raises: BaseException, InternalException, ResourceNotFoundException )describe_index_fields_responsedescribe_index_fields_result index_fieldsrLrzFieldNames.member.%dDescribeIndexFieldsrN IndexFieldsrr)r%rR field_namesr<r>rr]rrr describe_index_fieldszLayer1.describe_index_fieldscCr) a Describes RankExpressions in the search domain, optionally limited to a single expression. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type rank_names: list :param rank_names: Limit response to the specified rank names. :raises: BaseException, InternalException, ResourceNotFoundException )"describe_rank_expressions_response describe_rank_expressions_resultrank_expressionsrLrzRankNames.member.%dDescribeRankExpressionsrNRankExpressionsrr)r%rR rank_namesr<r>rrirrr describe_rank_expressionsrz Layer1.describe_rank_expressionscCrH)a Describes the resource-based policies controlling access to the services in this search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, ResourceNotFoundException ))describe_service_access_policies_response'describe_service_access_policies_resultaccess_policiesrLDescribeServiceAccessPoliciesrNrOrPrQrrr describe_service_access_policiesrz'Layer1.describe_service_access_policiescCrH)ad Describes stemming options used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, ResourceNotFoundException )"describe_stemming_options_response describe_stemming_options_resultstemsrLDescribeStemmingOptionsrNrOrPrQrrr describe_stemming_optionsrTz Layer1.describe_stemming_optionscCrH)ad Describes stopword options used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, ResourceNotFoundException )"describe_stopword_options_response describe_stopword_options_result stopwordsrLDescribeStopwordOptionsrNrOrPrQrrr describe_stopword_options rTz Layer1.describe_stopword_optionscCrH)ac Describes synonym options used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, ResourceNotFoundException )!describe_synonym_options_responsedescribe_synonym_options_resultsynonymsrLDescribeSynonymOptionsrNrOrPrQrrr describe_synonym_options"rTzLayer1.describe_synonym_optionscCs d}d|i}|j|d|dddS)aL Tells the search domain to start scanning its documents using the latest text processing options and ``IndexFields``. This operation must be invoked to make visible in searches any options whose OptionStatus has ``OptionState`` of ``RequiresIndexDocuments``. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :raises: BaseException, InternalException, ResourceNotFoundException )index_documents_responseindex_documents_resultrrLIndexDocumentsrN FieldNamesrrPrQrrr index_documents8s  zLayer1.index_documentscCro)a Updates options defining the default search field used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type default_search_field: string :param default_search_field: The IndexField to use for search requests issued with the q parameter. The default is an empty string, which automatically searches all text fields. :raises: BaseException, InternalException, InvalidTypeException, ResourceNotFoundException )$update_default_search_field_response"update_default_search_field_resultr})rLDefaultSearchFieldUpdateDefaultSearchFieldrNrOrP)r%rRr}r<r>rrr update_default_search_fieldRz"Layer1.update_default_search_fieldcCs d}||d}|j|d|ddS)a Updates the policies controlling access to the services in this search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type access_policies: string :param access_policies: An IAM access policy as described in The Access Policy Language in Using AWS Identity and Access Management. The maximum size of an access policy document is 100KB. :raises: BaseException, InternalException, LimitExceededException, ResourceNotFoundException, InvalidTypeException )'update_service_access_policies_response%update_service_access_policies_resultr)AccessPoliciesrLUpdateServiceAccessPoliciesrNrOrP)r%rRrr<r>rrr update_service_access_policiesqrz%Layer1.update_service_access_policiescCro)a Updates stemming options used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type stems: string :param stems: Maps terms to their stems. The JSON object has a single key called "stems" whose value is a dict mapping terms to their stems. The maximum size of a stemming document is 500KB. Example: {"stems":{"people": "person", "walking":"walk"}} :raises: BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException ) update_stemming_options_responseupdate_stemming_options_resultr)rLStemsUpdateStemmingOptionsrNrOrP)r%rRrr<r>rrr update_stemming_optionsrzLayer1.update_stemming_optionscCro)a Updates stopword options used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type stopwords: string :param stopwords: Lists stopwords in a JSON object. The object has a single key called "stopwords" whose value is an array of strings. The maximum size of a stopwords document is 10KB. Example: {"stopwords": ["a", "an", "the", "of"]} :raises: BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException ) update_stopword_options_responseupdate_stopword_options_resultr)rL StopwordsUpdateStopwordOptionsrNrOrP)r%rRrr<r>rrr update_stopword_optionsszLayer1.update_stopword_optionscCro)aB Updates synonym options used by indexing for the search domain. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names must be unique across the domains owned by an account within an AWS region. Domain names must start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). Uppercase letters and underscores are not allowed. :type synonyms: string :param synonyms: Maps terms to their synonyms. The JSON object has a single key "synonyms" whose value is a dict mapping terms to their synonyms. Each synonym is a simple string or an array of strings. The maximum size of a stopwords document is 100KB. Example: {"synonyms": {"cat": ["feline", "kitten"], "puppy": "dog"}} :raises: BaseException, InternalException, InvalidTypeException, LimitExceededException, ResourceNotFoundException )update_synonym_options_responseupdate_synonym_options_resultr)rLSynonymsUpdateSynonymOptionsrNrOrP)r%rRrr<r>rrr update_synonym_optionsruzLayer1.update_synonym_options)NNTNNNNNNrNNrNNTN)rNr(N)rUFFFN)N) __name__ __module__ __qualname__ APIVersionr/configr6r r!r#r'rGrSrdrjrnrtrzrrrrrrrrrrrrrrrrrr r $sP    cK     r )r/boto.jsonresponseboto.connectionrboto.regioninforr r rrrr s