Esempio n. 1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (MetadataId != null)
         {
             hashCode = hashCode * 59 + MetadataId.GetHashCode();
         }
         if (HasChanged != null)
         {
             hashCode = hashCode * 59 + HasChanged.GetHashCode();
         }
         if (IsCustomOptionSet != null)
         {
             hashCode = hashCode * 59 + IsCustomOptionSet.GetHashCode();
         }
         if (IsGlobal != null)
         {
             hashCode = hashCode * 59 + IsGlobal.GetHashCode();
         }
         if (IsManaged != null)
         {
             hashCode = hashCode * 59 + IsManaged.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ExternalTypeName != null)
         {
             hashCode = hashCode * 59 + ExternalTypeName.GetHashCode();
         }
         if (OptionSetType != null)
         {
             hashCode = hashCode * 59 + OptionSetType.GetHashCode();
         }
         if (IntroducedVersion != null)
         {
             hashCode = hashCode * 59 + IntroducedVersion.GetHashCode();
         }
         if (ParentOptionSetName != null)
         {
             hashCode = hashCode * 59 + ParentOptionSetName.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (DisplayName != null)
         {
             hashCode = hashCode * 59 + DisplayName.GetHashCode();
         }
         if (IsCustomizable != null)
         {
             hashCode = hashCode * 59 + IsCustomizable.GetHashCode();
         }
         if (Options != null)
         {
             hashCode = hashCode * 59 + Options.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 2
0
        internal static ScVmmVirtualMachineTemplateData DeserializeScVmmVirtualMachineTemplateData(JsonElement element)
        {
            ExtendedLocation             extendedLocation = default;
            IDictionary <string, string> tags             = default;
            AzureLocation      location        = default;
            ResourceIdentifier id              = default;
            string             name            = default;
            ResourceType       type            = default;
            SystemData         systemData      = default;
            Optional <string>  inventoryItemId = default;
            Optional <string>  uuid            = default;
            Optional <string>  vmmServerId     = default;
            Optional <OSType>  osType          = default;
            Optional <string>  osName          = default;
            Optional <string>  computerName    = default;
            Optional <int>     memoryMB        = default;
            Optional <int>     cpuCount        = default;
            Optional <LimitCpuForMigration> limitCpuForMigration = default;
            Optional <DynamicMemoryEnabled> dynamicMemoryEnabled = default;
            Optional <IsCustomizable>       isCustomizable       = default;
            Optional <int>    dynamicMemoryMaxMB = default;
            Optional <int>    dynamicMemoryMinMB = default;
            Optional <string> isHighlyAvailable  = default;
            Optional <int>    generation         = default;
            Optional <IReadOnlyList <NetworkInterfaces> > networkInterfaces = default;
            Optional <IReadOnlyList <VirtualDisk> >       disks             = default;
            Optional <string> provisioningState = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        dictionary.Add(property0.Name, property0.Value.GetString());
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = new AzureLocation(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = new ResourceIdentifier(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = new ResourceType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("systemData"))
                {
                    systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("inventoryItemId"))
                        {
                            inventoryItemId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmmServerId"))
                        {
                            vmmServerId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("osType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osType = new OSType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("osName"))
                        {
                            osName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("computerName"))
                        {
                            computerName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("memoryMB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            memoryMB = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("cpuCount"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            cpuCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("limitCpuForMigration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            limitCpuForMigration = new LimitCpuForMigration(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("dynamicMemoryEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dynamicMemoryEnabled = new DynamicMemoryEnabled(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("isCustomizable"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isCustomizable = new IsCustomizable(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("dynamicMemoryMaxMB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dynamicMemoryMaxMB = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("dynamicMemoryMinMB"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            dynamicMemoryMinMB = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("isHighlyAvailable"))
                        {
                            isHighlyAvailable = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("generation"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            generation = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("networkInterfaces"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <NetworkInterfaces> array = new List <NetworkInterfaces>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Models.NetworkInterfaces.DeserializeNetworkInterfaces(item));
                            }
                            networkInterfaces = array;
                            continue;
                        }
                        if (property0.NameEquals("disks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualDisk> array = new List <VirtualDisk>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualDisk.DeserializeVirtualDisk(item));
                            }
                            disks = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ScVmmVirtualMachineTemplateData(id, name, type, systemData, tags, location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, Optional.ToNullable(osType), osName.Value, computerName.Value, Optional.ToNullable(memoryMB), Optional.ToNullable(cpuCount), Optional.ToNullable(limitCpuForMigration), Optional.ToNullable(dynamicMemoryEnabled), Optional.ToNullable(isCustomizable), Optional.ToNullable(dynamicMemoryMaxMB), Optional.ToNullable(dynamicMemoryMinMB), isHighlyAvailable.Value, Optional.ToNullable(generation), Optional.ToList(networkInterfaces), Optional.ToList(disks), provisioningState.Value));
        }
Esempio n. 3
0
        /// <summary>
        /// Returns true if InlineResponseDefault6OptionSet instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponseDefault6OptionSet to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponseDefault6OptionSet other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     MetadataId == other.MetadataId ||
                     MetadataId != null &&
                     MetadataId.Equals(other.MetadataId)
                     ) &&
                 (
                     HasChanged == other.HasChanged ||
                     HasChanged != null &&
                     HasChanged.Equals(other.HasChanged)
                 ) &&
                 (
                     IsCustomOptionSet == other.IsCustomOptionSet ||
                     IsCustomOptionSet != null &&
                     IsCustomOptionSet.Equals(other.IsCustomOptionSet)
                 ) &&
                 (
                     IsGlobal == other.IsGlobal ||
                     IsGlobal != null &&
                     IsGlobal.Equals(other.IsGlobal)
                 ) &&
                 (
                     IsManaged == other.IsManaged ||
                     IsManaged != null &&
                     IsManaged.Equals(other.IsManaged)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ExternalTypeName == other.ExternalTypeName ||
                     ExternalTypeName != null &&
                     ExternalTypeName.Equals(other.ExternalTypeName)
                 ) &&
                 (
                     OptionSetType == other.OptionSetType ||
                     OptionSetType != null &&
                     OptionSetType.Equals(other.OptionSetType)
                 ) &&
                 (
                     IntroducedVersion == other.IntroducedVersion ||
                     IntroducedVersion != null &&
                     IntroducedVersion.Equals(other.IntroducedVersion)
                 ) &&
                 (
                     ParentOptionSetName == other.ParentOptionSetName ||
                     ParentOptionSetName != null &&
                     ParentOptionSetName.Equals(other.ParentOptionSetName)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                 ) &&
                 (
                     IsCustomizable == other.IsCustomizable ||
                     IsCustomizable != null &&
                     IsCustomizable.Equals(other.IsCustomizable)
                 ) &&
                 (
                     Options == other.Options ||
                     Options != null &&
                     Options.SequenceEqual(other.Options)
                 ));
        }