# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::CDN module Models # # Model object. # class OriginProperties include MsRestAzure # @return [String] The host name of the origin attr_accessor :host_name # @return [Integer] The value of the http port, must be between 1 and # 65535 attr_accessor :http_port # @return [Integer] The value of the https port, must be between 1 and # 65535 attr_accessor :https_port # @return [OriginResourceState] Resource status of the origin. Possible # values include: 'Creating', 'Active', 'Deleting' attr_accessor :resource_state # @return [ProvisioningState] Provisioning status of the origin. # Possible values include: 'Creating', 'Succeeded', 'Failed' attr_accessor :provisioning_state # # Validate the object. Throws ValidationError if validation fails. # def validate fail MsRest::ValidationError, 'property host_name is nil' if @host_name.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.host_name output_object['hostName'] = serialized_property unless serialized_property.nil? serialized_property = object.http_port output_object['httpPort'] = serialized_property unless serialized_property.nil? serialized_property = object.https_port output_object['httpsPort'] = serialized_property unless serialized_property.nil? serialized_property = object.resource_state output_object['resourceState'] = serialized_property unless serialized_property.nil? serialized_property = object.provisioning_state output_object['provisioningState'] = 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 [OriginProperties] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = OriginProperties.new deserialized_property = object['hostName'] output_object.host_name = deserialized_property deserialized_property = object['httpPort'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.http_port = deserialized_property deserialized_property = object['httpsPort'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.https_port = deserialized_property deserialized_property = object['resourceState'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = OriginResourceState.constants.any? { |e| OriginResourceState.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum OriginResourceState does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.resource_state = 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 output_object end end end end