# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Search module Models # # Defines all the properties of an Azure Search service. # class SearchServiceReadableProperties include MsRestAzure # @return [SearchServiceStatus] Gets the status of the Search service. # Possible values include: 'running', 'provisioning', 'deleting', # 'degraded', 'disabled', 'error' attr_accessor :status # @return [String] Gets the details of the Search service status. attr_accessor :status_details # @return [ProvisioningState] Gets the state of the last provisioning # operation performed on the Search service. Possible values include: # 'succeeded', 'provisioning', 'failed' attr_accessor :provisioning_state # @return [Sku] Gets or sets the SKU of the Search Service, which # determines price tier and capacity limits. attr_accessor :sku # @return [Integer] Gets or sets the number of replicas in the Search # service. If specified, it must be a value between 1 and 6 inclusive. attr_accessor :replica_count # @return [Integer] Gets or sets the number of partitions in the Search # service; if specified, it can be 1, 2, 3, 4, 6, or 12. attr_accessor :partition_count # # Validate the object. Throws ValidationError if validation fails. # def validate @sku.validate unless @sku.nil? end # # Serializes given Model object into Ruby Hash. # @param object Model object to serialize. # @return [Hash] Serialized object in form of Ruby Hash. # def self.serialize_object(object) object.validate output_object = {} serialized_property = object.status output_object['status'] = serialized_property unless serialized_property.nil? serialized_property = object.status_details output_object['statusDetails'] = serialized_property unless serialized_property.nil? serialized_property = object.provisioning_state output_object['provisioningState'] = serialized_property unless serialized_property.nil? serialized_property = object.sku unless serialized_property.nil? serialized_property = Sku.serialize_object(serialized_property) end output_object['sku'] = serialized_property unless serialized_property.nil? serialized_property = object.replica_count output_object['replicaCount'] = serialized_property unless serialized_property.nil? serialized_property = object.partition_count output_object['partitionCount'] = serialized_property unless serialized_property.nil? output_object end # # Deserializes given Ruby Hash into Model object. # @param object [Hash] Ruby Hash object to deserialize. # @return [SearchServiceReadableProperties] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = SearchServiceReadableProperties.new deserialized_property = object['status'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = SearchServiceStatus.constants.any? { |e| SearchServiceStatus.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum SearchServiceStatus does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.status = deserialized_property deserialized_property = object['statusDetails'] output_object.status_details = deserialized_property deserialized_property = object['provisioningState'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = ProvisioningState.constants.any? { |e| ProvisioningState.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum ProvisioningState does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.provisioning_state = deserialized_property deserialized_property = object['sku'] unless deserialized_property.nil? deserialized_property = Sku.deserialize_object(deserialized_property) end output_object.sku = deserialized_property deserialized_property = object['replicaCount'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.replica_count = deserialized_property deserialized_property = object['partitionCount'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.partition_count = deserialized_property output_object end end end end