# 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::Web module Models # # Model object. # class CertificateOrderProperties include MsRestAzure # @return [Hash{String => CertificateOrderCertificate}] State of the Key # Vault secret attr_accessor :certificates # @return [String] Certificate distinguished name attr_accessor :distinguished_name # @return [String] Domain Verification Token attr_accessor :domain_verification_token # @return [Integer] Duration in years (must be between 1 and 3) attr_accessor :validity_in_years # @return [Integer] Certificate Key Size attr_accessor :key_size # @return [CertificateProductType] Certificate product type. Possible # values include: 'StandardDomainValidatedSsl', # 'StandardDomainValidatedWildCardSsl' attr_accessor :product_type # @return [Boolean] Auto renew attr_accessor :auto_renew # @return [ProvisioningState] Status of certificate order. Possible # values include: 'Succeeded', 'Failed', 'Canceled', 'InProgress', # 'Deleting' attr_accessor :provisioning_state # @return [CertificateOrderStatus] Current order status. Possible values # include: 'Pendingissuance', 'Issued', 'Revoked', 'Canceled', # 'Denied', 'Pendingrevocation', 'PendingRekey', 'Unused', 'Expired', # 'NotSubmitted' attr_accessor :status # @return [CertificateDetails] Signed certificate attr_accessor :signed_certificate # @return [String] Last CSR that was created for this order attr_accessor :csr # @return [CertificateDetails] Intermediate certificate attr_accessor :intermediate # @return [CertificateDetails] Root certificate attr_accessor :root # @return [String] Current serial number of the certificate attr_accessor :serial_number # @return [DateTime] Certificate last issuance time attr_accessor :last_certificate_issuance_time # @return [DateTime] Certificate expiration time attr_accessor :expiration_time # # Validate the object. Throws ValidationError if validation fails. # def validate @certificates.each{ |e| e.validate if e.respond_to?(:validate) } unless @certificates.nil? @signed_certificate.validate unless @signed_certificate.nil? @intermediate.validate unless @intermediate.nil? @root.validate unless @root.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.certificates unless serialized_property.nil? serialized_property.each { |key, valueElement| unless valueElement.nil? valueElement = CertificateOrderCertificate.serialize_object(valueElement) end serialized_property[key] = valueElement } end output_object['certificates'] = serialized_property unless serialized_property.nil? serialized_property = object.distinguished_name output_object['distinguishedName'] = serialized_property unless serialized_property.nil? serialized_property = object.domain_verification_token output_object['domainVerificationToken'] = serialized_property unless serialized_property.nil? serialized_property = object.validity_in_years output_object['validityInYears'] = serialized_property unless serialized_property.nil? serialized_property = object.key_size output_object['keySize'] = serialized_property unless serialized_property.nil? serialized_property = object.product_type output_object['productType'] = serialized_property unless serialized_property.nil? serialized_property = object.auto_renew output_object['autoRenew'] = serialized_property unless serialized_property.nil? serialized_property = object.provisioning_state output_object['provisioningState'] = serialized_property unless serialized_property.nil? serialized_property = object.status output_object['status'] = serialized_property unless serialized_property.nil? serialized_property = object.signed_certificate unless serialized_property.nil? serialized_property = CertificateDetails.serialize_object(serialized_property) end output_object['signedCertificate'] = serialized_property unless serialized_property.nil? serialized_property = object.csr output_object['csr'] = serialized_property unless serialized_property.nil? serialized_property = object.intermediate unless serialized_property.nil? serialized_property = CertificateDetails.serialize_object(serialized_property) end output_object['intermediate'] = serialized_property unless serialized_property.nil? serialized_property = object.root unless serialized_property.nil? serialized_property = CertificateDetails.serialize_object(serialized_property) end output_object['root'] = serialized_property unless serialized_property.nil? serialized_property = object.serial_number output_object['serialNumber'] = serialized_property unless serialized_property.nil? serialized_property = object.last_certificate_issuance_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['lastCertificateIssuanceTime'] = serialized_property unless serialized_property.nil? serialized_property = object.expiration_time serialized_property = serialized_property.new_offset(0).strftime('%FT%TZ') output_object['expirationTime'] = 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 [CertificateOrderProperties] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = CertificateOrderProperties.new deserialized_property = object['certificates'] unless deserialized_property.nil? deserialized_property.each do |key, valueElement1| unless valueElement1.nil? valueElement1 = CertificateOrderCertificate.deserialize_object(valueElement1) end deserialized_property[key] = valueElement1 end end output_object.certificates = deserialized_property deserialized_property = object['distinguishedName'] output_object.distinguished_name = deserialized_property deserialized_property = object['domainVerificationToken'] output_object.domain_verification_token = deserialized_property deserialized_property = object['validityInYears'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.validity_in_years = deserialized_property deserialized_property = object['keySize'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.key_size = deserialized_property deserialized_property = object['productType'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = CertificateProductType.constants.any? { |e| CertificateProductType.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum CertificateProductType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid end output_object.product_type = deserialized_property deserialized_property = object['autoRenew'] output_object.auto_renew = 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['status'] if (!deserialized_property.nil? && !deserialized_property.empty?) enum_is_valid = CertificateOrderStatus.constants.any? { |e| CertificateOrderStatus.const_get(e).to_s.downcase == deserialized_property.downcase } warn 'Enum CertificateOrderStatus 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['signedCertificate'] unless deserialized_property.nil? deserialized_property = CertificateDetails.deserialize_object(deserialized_property) end output_object.signed_certificate = deserialized_property deserialized_property = object['csr'] output_object.csr = deserialized_property deserialized_property = object['intermediate'] unless deserialized_property.nil? deserialized_property = CertificateDetails.deserialize_object(deserialized_property) end output_object.intermediate = deserialized_property deserialized_property = object['root'] unless deserialized_property.nil? deserialized_property = CertificateDetails.deserialize_object(deserialized_property) end output_object.root = deserialized_property deserialized_property = object['serialNumber'] output_object.serial_number = deserialized_property deserialized_property = object['lastCertificateIssuanceTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.last_certificate_issuance_time = deserialized_property deserialized_property = object['expirationTime'] deserialized_property = DateTime.parse(deserialized_property) unless deserialized_property.to_s.empty? output_object.expiration_time = deserialized_property output_object end end end end