o ckF[R@spddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd Z Gd d d e Z d S) IndexFieldStatus)ServicePoliciesStatusExpressionStatus)AvailabilityOptionsStatus)ScalingParametersStatusDocumentServiceConnectionSearchConnectioncCs|dvrdSdS)N)TtrueTrueTRUETF)valuerr:/usr/lib/python3/dist-packages/boto/cloudsearch2/domain.py handle_bool src@sneZdZdZddZddZeddZedd Zed d Z ed d Z e j dd Z eddZ e j ddZ eddZ e j ddZ eddZej ddZeddZej ddZeddZej ddZeddZed d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd?d/d0Z 2 2 . .d@d3d4Zd?d5d6Zd7d8Zd9d:Zd;d<Zd=d>Zd.S)ADomaina A Cloudsearch domain. :ivar name: The name of the domain. :ivar id: The internally generated unique identifier for the domain. :ivar created: A boolean which is True if the domain is created. It can take several minutes to initialize a domain when CreateDomain is called. Newly created search domains are returned with a False value for Created until domain creation is complete :ivar deleted: A boolean which is True if the search domain has been deleted. The system must clean up resources dedicated to the search domain when delete is called. Newly deleted search domains are returned from list_domains with a True value for deleted for several minutes until resource cleanup is complete. :ivar processing: True if processing is being done to activate the current domain configuration. :ivar num_searchable_docs: The number of documents that have been submittted to the domain and indexed. :ivar requires_index_document: True if index_documents needs to be called to activate the current domain configuration. :ivar search_instance_count: The number of search instances that are available to process search requests. :ivar search_instance_type: The instance type that is being used to process search requests. :ivar search_partition_count: The number of partitions across which the search index is spread. cCs||_||dS)a# Constructor - Create a domain object from a layer1 and data params :type layer1: :class:`boto.cloudsearch2.layer1.Layer1` object :param layer1: A :class:`boto.cloudsearch2.layer1.Layer1` object which is used to perform operations on the domain. N)layer1update_from_data)selfrdatarrr__init__NszDomain.__init__cCs|d|_|d|_|d|_|d|_|d|_|d|_|d|_|dd|_|d |_ |d |_ |d |_ |d |_ dS) NCreatedDeleted ProcessingRequiresIndexDocumentsDomainId DomainNameSearchInstanceCountSearchInstanceTypeSearchPartitionCount DocServiceARN SearchService) createddeleted processingrequires_index_documents domain_id domain_namesearch_instance_countgetsearch_instance_typesearch_partition_count _doc_service _service_arn_search_service)rrrrrrYs          zDomain.update_from_datacC|jSN)r2rrrr service_arngzDomain.service_arncC |jdSNEndpoint)r1r6rrrdoc_service_endpointk zDomain.doc_service_endpointcCr9r:)r3r6rrrsearch_service_endpointor=zDomain.search_service_endpointcCr4r5)_createdr6rrrr'sr8zDomain.createdcCt||_dSr5)rr?rrrrrr'wcCr4r5)_deletedr6rrrr({r8zDomain.deletedcCr@r5)rrCrArrrr(rBcCr4r5) _processingr6rrrr)r8zDomain.processingcCr@r5)rrDrArrrr)rBcCr4r5)_requires_index_documentsr6rrrr*r8zDomain.requires_index_documentscCr@r5)rrErArrrr*rBcCr4r5)_search_partition_countr6rrrr0r8zDomain.search_partition_countcCr@r5)intrFrArrrr0rBcCr4r5)_search_instance_countr6rrrr-r8zDomain.search_instance_countcCr@r5)rGrHrArrrr-rBcCr4r5r,r6rrrnamer8z Domain.namecCr4r5)r+r6rrridr8z Domain.idcC|j|jS)zK Delete this domain and all index data associated with it. )r delete_domainrJr6rrrdeletez Domain.deletecCrL)z; Return a list of Analysis Scheme objects. )rdescribe_analysis_schemesrJr6rrrget_analysis_schemesrOzDomain.get_analysis_schemescCt||jjgd|jjdS)a: Return a :class:`boto.cloudsearch2.option.AvailabilityOptionsStatus` object representing the currently defined availability options for the domain. :return: OptionsStatus object :rtype: :class:`boto.cloudsearch2.option.AvailabilityOptionsStatus` object )#DescribeAvailabilityOptionsResponse!DescribeAvailabilityOptionsResultAvailabilityOptions refresh_fn refresh_keysave_fn)rrdescribe_availability_optionsupdate_availability_optionsr6rrrget_availability_options  zDomain.get_availability_optionscCrR)a; Return a :class:`boto.cloudsearch2.option.ScalingParametersStatus` object representing the currently defined scaling options for the domain. :return: ScalingParametersStatus object :rtype: :class:`boto.cloudsearch2.option.ScalingParametersStatus` object )!DescribeScalingParametersResponseDescribeScalingParametersResultScalingParametersrV)rrdescribe_scaling_parametersupdate_scaling_parametersr6rrrget_scaling_optionsr]zDomain.get_scaling_optionscCrR)a) Return a :class:`boto.cloudsearch2.option.ServicePoliciesStatus` object representing the currently defined access policies for the domain. :return: ServicePoliciesStatus object :rtype: :class:`boto.cloudsearch2.option.ServicePoliciesStatus` object )%DescribeServiceAccessPoliciesResponse#DescribeServiceAccessPoliciesResultAccessPoliciesrV)rr describe_service_access_policiesupdate_service_access_policiesr6rrrget_access_policiess zDomain.get_access_policiescCs|j|jdS)a* Tells the search domain to start indexing its documents using the latest text processing options and IndexFields. This operation must be invoked to make options whose OptionStatus has OptionState of RequiresIndexDocuments visible in search results. N)rindex_documentsrJr6rrrrjszDomain.index_documentsNcs2jj|}|ddd}fdd|DS)z Return a list of index fields defined for this domain. :return: list of IndexFieldStatus objects :rtype: list of :class:`boto.cloudsearch2.option.IndexFieldStatus` object DescribeIndexFieldsResponseDescribeIndexFieldsResult IndexFieldscsg|]}t|qSrr.0dr6rr sz+Domain.get_index_fields..)rdescribe_index_fieldsrJ)r field_namesrrr6rget_index_fieldsszDomain.get_index_fieldsFc Cs||d} |dkr$||||d| d<|r|| dd<| r"| | dd<nS|dkrE|||d| d <|r8|| d d<| rCd | | d d <n2|d kre|||||d | d<|r[|| dd<| rc| | dd<n|dkr|||d| d<|ry|| dd<| rd | | dd <n|dkr||||d| d<|r|| dd<| r| | dd<n|dkr|||d| d<|r|| dd<| rd | | dd <n|dkr||||d| d<|r|| dd<| r| | dd<n|dkr|||d| d<|r|| dd<| rd | | dd <nt|dkr,|||d| d<|r|| dd<| r"| | dd<| r+| | dd<nK|dkrW||d| d<|rA|| dd<| rMd | | dd <| rV| | dd<n |d krw||||d| d!<|rn|| d!d<| rw| | d!d<|j|j| } | d"d#d$} t|| |jjS)%a Defines an ``IndexField``, either replacing an existing definition or creating a new one. :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 int | double | literal | text | date | latlon | int-array | double-array | literal-array | text-array | date-array :type default: string or int :param default: The default value for the field. If the field is of type ``int`` 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 ``int, int-array, text, text-array``. :type returnable: bool :param returnable: A boolean to indicate whether values of this field can be returned in search results or used in ranking. :type searchable: bool :param searchable: A boolean to indicate whether search is enabled for this field or not. :type sortable: bool :param sortable: A boolean to indicate whether sorting is enabled for this field or not. Does not apply to fields of array types. :type highlight: bool :param highlight: A boolean to indicate whether highlighting is enabled for this field or not. Does not apply to fields of type ``double, int, date, latlon`` :type source_field: list of strings or string :param source_field: For array types, this is the list of fields to treat as the source. For singular types, pass a string only. :type analysis_scheme: string :param analysis_scheme: The analysis scheme to use for this field. Only applies to ``text | text-array`` field types :return: IndexFieldStatus objects :rtype: :class:`boto.cloudsearch2.option.IndexFieldStatus` object :raises: BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException )IndexFieldNameIndexFieldTypeliteral) FacetEnabled ReturnEnabled SearchEnabled SortEnabledLiteralOptions DefaultValue SourceFieldz literal-array)ryrzr{LiteralArrayOptions, SourceFieldsrG)r~ryrzr{r| IntOptionsz int-arrayIntArrayOptionsdate DateOptionsz date-arrayDateArrayOptionsdouble DoubleOptionsz double-arrayDoubleArrayOptionstext)rzHighlightEnabledr| TextOptionsAnalysisSchemez text-array)rzrTextArrayOptionslatlon LatLonOptionsDefineIndexFieldResponseDefineIndexFieldResult IndexField)joinrdefine_index_fieldrJrrr) r field_name field_typedefaultfacet returnable searchablesortable highlight source_fieldanalysis_schemeindexrrrrcreate_index_fields=                                       zDomain.create_index_fieldcs8jjj|}|ddd}fdd|DS)z Return a list of rank expressions defined for this domain. :return: list of ExpressionStatus objects :rtype: list of :class:`boto.cloudsearch2.option.ExpressionStatus` object DescribeExpressionsResponseDescribeExpressionsResult Expressionscsg|]}t|qSrrrnfnrrrrqsz*Domain.get_expressions..)rdescribe_expressionsrJ)rnamesrrrrget_expressionss zDomain.get_expressionscCs2|j|j||}|ddd}t|||jjS)az Create a new expression. :type name: string :param name: The name of an expression for processing during a search request. :type value: string :param value: The expression to evaluate for ranking or thresholding while processing a search request. The Expression syntax is based on JavaScript expressions and supports: * Single value, sort enabled numeric fields (int, double, date) * Other expressions * The _score variable, which references a document's relevance score * The _time variable, which references the current epoch time * Integer, floating point, hex, and octal literals * Arithmetic operators: + - * / % * Bitwise operators: | & ^ ~ << >> >>> * Boolean operators (including the ternary operator): && || ! ?: * Comparison operators: < <= == >= > * Mathematical functions: abs ceil exp floor ln log2 log10 logn max min pow sqrt pow * Trigonometric functions: acos acosh asin asinh atan atan2 atanh cos cosh sin sinh tanh tan * The haversin distance function Expressions always return an integer value from 0 to the maximum 64-bit signed integer value (2^63 - 1). Intermediate results are calculated as double-precision floating point values and the return value is rounded to the nearest integer. If the expression is invalid or evaluates to a negative value, it returns 0. If the expression evaluates to a value greater than the maximum, it returns the maximum value. The source data for an Expression can be the name of an IndexField of type int or double, another Expression or the reserved name _score. The _score source is defined to return as a double from 0 to 10.0 (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. :return: ExpressionStatus object :rtype: :class:`boto.cloudsearch2.option.ExpressionStatus` object :raises: BaseException, InternalException, LimitExceededException, InvalidTypeException, ResourceNotFoundException DefineExpressionResponseDefineExpressionResult Expression)rdefine_expressionrJrr)rrJrrrrrcreate_expressions9zDomain.create_expressioncC t|dSN)domainr r6rrrget_document_service zDomain.get_document_servicecCrrr r6rrrget_search_servicerzDomain.get_search_servicecCs d|jS)Nz rIr6rrr__repr__rzDomain.__repr__r5)ruFFFFFNN) __name__ __module__ __qualname____doc__rrpropertyr7r<r>r'setterr(r)r*r0r-rJrKrNrQr\rcrirjrtrrrrrrrrrrr&sp'                     GB rN) boto.cloudsearch2.optionstatusrrrrrboto.cloudsearch2.documentr boto.cloudsearch2.searchr robjectrrrrrs