/// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Containers == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Containers");
     }
     if (OsType == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "OsType");
     }
     if (Containers != null)
     {
         foreach (var element in Containers)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (ImageRegistryCredentials != null)
     {
         foreach (var element1 in ImageRegistryCredentials)
         {
             if (element1 != null)
             {
                 element1.Validate();
             }
         }
     }
     if (IpAddress != null)
     {
         IpAddress.Validate();
     }
     if (Volumes != null)
     {
         foreach (var element2 in Volumes)
         {
             if (element2 != null)
             {
                 element2.Validate();
             }
         }
     }
     if (Diagnostics != null)
     {
         Diagnostics.Validate();
     }
     if (NetworkProfile != null)
     {
         NetworkProfile.Validate();
     }
     if (DnsConfig != null)
     {
         DnsConfig.Validate();
     }
 }
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (Containers == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Containers");
     }
     if (OsType == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "OsType");
     }
     if (Containers != null)
     {
         foreach (var element in Containers)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
     if (ImageRegistryCredentials != null)
     {
         foreach (var element1 in ImageRegistryCredentials)
         {
             if (element1 != null)
             {
                 element1.Validate();
             }
         }
     }
     if (IpAddress != null)
     {
         IpAddress.Validate();
     }
     if (Volumes != null)
     {
         foreach (var element2 in Volumes)
         {
             if (element2 != null)
             {
                 element2.Validate();
             }
         }
     }
     if (Diagnostics != null)
     {
         Diagnostics.Validate();
     }
     if (SubnetIds != null)
     {
         foreach (var element3 in SubnetIds)
         {
             if (element3 != null)
             {
                 element3.Validate();
             }
         }
     }
     if (DnsConfig != null)
     {
         DnsConfig.Validate();
     }
     if (EncryptionProperties != null)
     {
         EncryptionProperties.Validate();
     }
     if (InitContainers != null)
     {
         foreach (var element4 in InitContainers)
         {
             if (element4 != null)
             {
                 element4.Validate();
             }
         }
     }
 }