o ckF[5@sXddlZddlmZddlmZddlmZddlmZddl m Z GdddeZ dS) N)json)AWSQueryConnection) RegionInfo)JSONResponseError) exceptionscsBeZdZdZdZdZdZeZe j e j e j e j e je jdZfddZdd Zd d Zd d ZddZddZddZddZddZddZddZddZddZ d?d!d"Zd@d#d$Zd@d%d&Z d?d'd(Z! d?d)d*Z"d+d,Z#d@d-d.Z$ d?d/d0Z%d1d2Z&d3d4Z'd5d6Z(d7d8Z)d9d:Z*d;d<Z+d=d>Z,Z-S)ACloudSearchConnectionaj Amazon CloudSearch Configuration Service You use the Amazon CloudSearch configuration service to create, configure, and manage search domains. Configuration service requests are submitted using the AWS Query protocol. AWS Query requests are HTTP or HTTPS requests submitted via HTTP GET or POST with a query parameter named Action. The endpoint for configuration service requests is region- specific: cloudsearch. region .amazonaws.com. For example, cloudsearch.us-east-1.amazonaws.com. For a current list of supported regions and endpoints, see `Regions and Endpoints`_. z 2013-01-01z us-east-1z#cloudsearch.us-east-1.amazonaws.com)InvalidTypeExceptionLimitExceededExceptionInternalExceptionDisabledOperationExceptionResourceNotFoundException BaseExceptionc sp|dd}|st||j|j}d|vs|ddur|j|d<|dd}||_tt|jdi|||_ dS)Nregionhost sign_requestF) poprDefaultRegionNameDefaultRegionEndpointendpointrsuperr__init__r)selfkwargsrr __class__r:/usr/lib/python3/dist-packages/boto/cloudsearch2/layer1.pyr;s    zCloudSearchConnection.__init__cCsdgS)Nzhmac-v4r)rrrr_required_auth_capabilityJsz/CloudSearchConnection._required_auth_capabilitycCd|i}|jddd|dS)a Indexes the search suggestions. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). DomainNameBuildSuggestersPOST/actionverbpathparams _make_requestr domain_namer'rrrbuild_suggestersM  z&CloudSearchConnection.build_suggesterscCr)a Creates a new search domain. For more information, see `Creating a Search Domain`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A name for the domain you are creating. Allowed characters are a-z (lower-case letters), 0-9, and hyphen (-). Domain names must start with a letter or number and be at least 3 and no more than 28 characters long. r CreateDomainr!r"r#r(r*rrr create_domain_s  z#CloudSearchConnection.create_domaincC(d|i}||d||jddd|dS)a Configures an analysis scheme that can be applied to a `text` or `text-array` field to define language-specific text processing options. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type analysis_scheme: dict :param analysis_scheme: Configuration information for an analysis scheme. Each analysis scheme has a unique name and specifies the language of the text to be processed. The following options can be configured for an analysis scheme: `Synonyms`, `Stopwords`, `StemmingDictionary`, and `AlgorithmicStemming`. rAnalysisSchemeDefineAnalysisSchemer!r"r#build_complex_paramr))rr+analysis_schemer'rrrdefine_analysis_schemersz,CloudSearchConnection.define_analysis_schemecCr0)a Configures an `Expression` for the search domain. Used to create new expressions and modify existing ones. If the expression exists, the new configuration replaces the old one. For more information, see `Configuring Expressions`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type expression: dict :param expression: A named expression that can be evaluated at search time. Can be used to sort the search results, define other expressions, or return computed information in the search results. r ExpressionDefineExpressionr!r"r#r3)rr+ expressionr'rrrdefine_expressionsz'CloudSearchConnection.define_expressioncCr0)ao Configures an `IndexField` for the search domain. Used to create new fields and modify existing ones. You must specify the name of the domain you are configuring and an index field configuration. The index field configuration specifies a unique name, the index field type, and the options you want to configure for the field. The options you can specify depend on the `IndexFieldType`. If the field exists, the new configuration replaces the old one. For more information, see `Configuring Index Fields`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type index_field: dict :param index_field: The index field and field options you want to configure. r IndexFieldDefineIndexFieldr!r"r#r3)rr+ index_fieldr'rrrdefine_index_fieldsz(CloudSearchConnection.define_index_fieldcCr0)az Configures a suggester for a domain. A suggester enables you to display possible matches before users finish typing their queries. When you configure a suggester, you must specify the name of the text field you want to search for possible matches and a unique name for the suggester. For more information, see `Getting Search Suggestions`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type suggester: dict :param suggester: Configuration information for a search suggester. Each suggester has a unique name and specifies the text field you want to use for suggestions. The following options can be configured for a suggester: `FuzzyMatching`, `SortExpression`. r SuggesterDefineSuggesterr!r"r#r3)rr+ suggesterr'rrrdefine_suggesterz&CloudSearchConnection.define_suggestercC||d}|jddd|dS)a Deletes an analysis scheme. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type analysis_scheme_name: string :param analysis_scheme_name: The name of the analysis scheme you want to delete. )rAnalysisSchemeNameDeleteAnalysisSchemer!r"r#r()rr+analysis_scheme_namer'rrrdelete_analysis_schemez,CloudSearchConnection.delete_analysis_schemecCr)a Permanently deletes a search domain and all of its data. Once a domain has been deleted, it cannot be recovered. For more information, see `Deleting a Search Domain`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to permanently delete. r DeleteDomainr!r"r#r(r*rrr delete_domain r-z#CloudSearchConnection.delete_domaincCrD)a Removes an `Expression` from the search domain. For more information, see `Configuring Expressions`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type expression_name: string :param expression_name: The name of the `Expression` to delete. )rExpressionNameDeleteExpressionr!r"r#r()rr+expression_namer'rrrdelete_expressionz'CloudSearchConnection.delete_expressioncCrD)a Removes an `IndexField` from the search domain. For more information, see `Configuring Index Fields`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type index_field_name: string :param index_field_name: The name of the index field your want to remove from the domain's indexing options. )rIndexFieldNameDeleteIndexFieldr!r"r#r()rr+index_field_namer'rrrdelete_index_field5rIz(CloudSearchConnection.delete_index_fieldcCrD)a Deletes a suggester. For more information, see `Getting Search Suggestions`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type suggester_name: string :param suggester_name: Specifies the name of the suggester you want to delete. )r SuggesterNameDeleteSuggesterr!r"r#r()rr+suggester_namer'rrrdelete_suggesterPrPz&CloudSearchConnection.delete_suggesterNcCHd|i}|dur|||d|durt||d<|jddd|dS) a Gets the analysis schemes configured for a domain. An analysis scheme defines language-specific text processing options for a `text` field. Can be limited to specific analysis schemes by name. By default, shows all analysis schemes and includes any pending changes to the configuration. Set the `Deployed` option to `True` to show the active configuration and exclude pending changes. For more information, see `Configuring Analysis Schemes`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to describe. :type analysis_scheme_names: list :param analysis_scheme_names: The analysis schemes you want to describe. :type deployed: boolean :param deployed: Whether to display the deployed configuration ( `True`) or include any pending changes ( `False`). Defaults to `False`. rNzAnalysisSchemeNames.memberDeployedDescribeAnalysisSchemesr!r"r#build_list_paramsstrlowerr))rr+analysis_scheme_namesdeployedr'rrrdescribe_analysis_schemesj"z/CloudSearchConnection.describe_analysis_schemescC2d|i}|durt||d<|jddd|dS)a Gets the availability options configured for a domain. By default, shows the configuration with any pending changes. Set the `Deployed` option to `True` to show the active configuration and exclude pending changes. For more information, see `Configuring Availability Options`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to describe. :type deployed: boolean :param deployed: Whether to display the deployed configuration ( `True`) or include any pending changes ( `False`). Defaults to `False`. rNrZDescribeAvailabilityOptionsr!r"r#r^r_r)rr+rar'rrrdescribe_availability_optionssz3CloudSearchConnection.describe_availability_optionscCs,i}|dur |||d|jddd|dS)az Gets information about the search domains owned by this account. Can be limited to specific domains. Shows all domains by default. To get the number of searchable documents in a domain, use the console or submit a `matchall` request to your domain's search endpoint: `q=matchall&q.parser=structured&size=0`. For more information, see `Getting Information about a Search Domain`_ in the Amazon CloudSearch Developer Guide . :type domain_names: list :param domain_names: The names of the domains you want to include in the response. NzDomainNames.memberDescribeDomainsr!r"r#)r]r))r domain_namesr'rrrdescribe_domainssz&CloudSearchConnection.describe_domainscCrY) a Gets the expressions configured for the search domain. Can be limited to specific expressions by name. By default, shows all expressions and includes any pending changes to the configuration. Set the `Deployed` option to `True` to show the active configuration and exclude pending changes. For more information, see `Configuring Expressions`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to describe. :type expression_names: list :param expression_names: Limits the `DescribeExpressions` response to the specified expressions. If not specified, all expressions are shown. :type deployed: boolean :param deployed: Whether to display the deployed configuration ( `True`) or include any pending changes ( `False`). Defaults to `False`. rNzExpressionNames.memberrZDescribeExpressionsr!r"r#r\)rr+expression_namesrar'rrrdescribe_expressionsrcz*CloudSearchConnection.describe_expressionscCrY) a Gets information about the index fields configured for the search domain. Can be limited to specific fields by name. By default, shows all fields and includes any pending changes to the configuration. Set the `Deployed` option to `True` to show the active configuration and exclude pending changes. For more information, see `Getting Domain Information`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to describe. :type field_names: list :param field_names: A list of the index fields you want to describe. If not specified, information is returned for all configured index fields. :type deployed: boolean :param deployed: Whether to display the deployed configuration ( `True`) or include any pending changes ( `False`). Defaults to `False`. rNzFieldNames.memberrZDescribeIndexFieldsr!r"r#r\)rr+ field_namesrar'rrrdescribe_index_fieldsrcz+CloudSearchConnection.describe_index_fieldscCr)a Gets the scaling parameters configured for a domain. A domain's scaling parameters specify the desired search instance type and replication count. For more information, see `Configuring Scaling Options`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). rDescribeScalingParametersr!r"r#r(r*rrrdescribe_scaling_parameterss z1CloudSearchConnection.describe_scaling_parameterscCrd)a Gets information about the access policies that control access to the domain's document and search endpoints. By default, shows the configuration with any pending changes. Set the `Deployed` option to `True` to show the active configuration and exclude pending changes. For more information, see `Configuring Access for a Search Domain`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to describe. :type deployed: boolean :param deployed: Whether to display the deployed configuration ( `True`) or include any pending changes ( `False`). Defaults to `False`. rNrZDescribeServiceAccessPoliciesr!r"r#rfrgrrr describe_service_access_policies'sz6CloudSearchConnection.describe_service_access_policiescCrY) a Gets the suggesters configured for a domain. A suggester enables you to display possible matches before users finish typing their queries. Can be limited to specific suggesters by name. By default, shows all suggesters and includes any pending changes to the configuration. Set the `Deployed` option to `True` to show the active configuration and exclude pending changes. For more information, see `Getting Search Suggestions`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: The name of the domain you want to describe. :type suggester_names: list :param suggester_names: The suggesters you want to describe. :type deployed: boolean :param deployed: Whether to display the deployed configuration ( `True`) or include any pending changes ( `False`). Defaults to `False`. rNzSuggesterNames.memberrZDescribeSuggestersr!r"r#r\)rr+suggester_namesrar'rrrdescribe_suggestersCs"z)CloudSearchConnection.describe_suggesterscCr)aV Tells the search domain to start indexing its documents using the latest indexing options. This operation must be invoked to activate options whose OptionStatus is `RequiresIndexDocuments`. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). rIndexDocumentsr!r"r#r(r*rrrindex_documentshs z%CloudSearchConnection.index_documentscCsi}|jddd|dS)z? Lists all search domains owned by an account. ListDomainNamesr!r"r#r()rr'rrrlist_domain_names}s z'CloudSearchConnection.list_domain_namescCrD)a Configures the availability options for a domain. Enabling the Multi-AZ option expands an Amazon CloudSearch domain to an additional Availability Zone in the same Region to increase fault tolerance in the event of a service disruption. Changes to the Multi-AZ option can take about half an hour to become active. For more information, see `Configuring Availability Options`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type multi_az: boolean :param multi_az: You expand an existing search domain to a second Availability Zone by setting the Multi-AZ option to true. Similarly, you can turn off the Multi-AZ option to downgrade the domain to a single Availability Zone by setting the Multi-AZ option to `False`. )rMultiAZUpdateAvailabilityOptionsr!r"r#r()rr+multi_azr'rrrupdate_availability_optionss z1CloudSearchConnection.update_availability_optionscCr0)a` Configures scaling parameters for a domain. A domain's scaling parameters specify the desired search instance type and replication count. Amazon CloudSearch will still automatically scale your domain based on the volume of data and traffic, but not below the desired instance type and replication count. If the Multi-AZ option is enabled, these values control the resources used per Availability Zone. For more information, see `Configuring Scaling Options`_ in the Amazon CloudSearch Developer Guide . :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type scaling_parameters: dict :param scaling_parameters: The desired instance type and desired number of replicas of each index partition. rScalingParametersUpdateScalingParametersr!r"r#r3)rr+scaling_parametersr'rrrupdate_scaling_parametersrCz/CloudSearchConnection.update_scaling_parameterscCrD)a Configures the access rules that control access to the domain's document and search endpoints. For more information, see ` Configuring Access for an Amazon CloudSearch Domain`_. :type domain_name: string :param domain_name: A string that represents the name of a domain. Domain names are unique across the domains owned by an account within an AWS region. Domain names start with a letter or number and can contain the following characters: a-z (lowercase), 0-9, and - (hyphen). :type access_policies: string :param access_policies: The access rules you want to configure. These rules replace any existing rules. )rAccessPoliciesUpdateServiceAccessPoliciesr!r"r#r()rr+access_policiesr'rrrupdate_service_access_policiesrIz4CloudSearchConnection.update_service_access_policiescCs~|D]8\}}t|tr"|D]\}}|||d||qqt|tr4|r+dp,d|d||f<q||d||f<qdS)aSerialize a structure. For example:: param_type = 'structure' label = 'IndexField' value = {'IndexFieldName': 'a', 'IntOptions': {'DefaultValue': 5}} would result in the params dict being updated with these params:: IndexField.IndexFieldName = a IndexField.IntOptions.DefaultValue = 5 :type params: dict :param params: The params dict. The complex list params will be added to this dict. :type label: str :param label: String label for param key :type value: any :param value: The value to serialize .truefalsez%s.%sN)items isinstancedictr4bool)rr'labelvaluekvk2v2rrrr4s  z)CloudSearchConnection.build_complex_paramc Csd|d<|j|dd|d}|d}tj||jdkr$t|St|}| di d d}|j ||j } | |j|j |d ) NJSON ContentTyper!r"r#zutf-8ErrorCode)body) make_requestreaddecodebotologdebugstatusrloadsget_faults ResponseErrorreason) rr$r%r&r'responser json_body fault_nameexception_classrrrr)s     z#CloudSearchConnection._make_request)NN)N).__name__ __module__ __qualname____doc__ APIVersionrrrrrrr r r r r rrrr,r/r6r:r>rBrHrKrOrTrXrbrhrkrnrqrsrurxrzr|rrrr4r) __classcell__rrrrrs`  !  &  & &  %  !r) r boto.compatrboto.connectionrboto.regioninforboto.exceptionrboto.cloudsearch2rrrrrrs