Example #1
0
        private void Run()
        {
            // Sku
            SnapshotSku vSku = null;

            // CreationData
            CreationData vCreationData = null;

            // EncryptionSettingsCollection
            EncryptionSettingsCollection vEncryptionSettingsCollection = null;

            // Encryption
            Encryption vEncryption = null;

            // ExtendedLocation
            ExtendedLocation vExtendedLocation = null;

            if (this.IsParameterBound(c => c.SkuName))
            {
                if (vSku == null)
                {
                    vSku = new SnapshotSku();
                }
                vSku.Name = this.SkuName;
            }

            if (this.IsParameterBound(c => c.CreateOption))
            {
                if (vCreationData == null)
                {
                    vCreationData = new CreationData();
                }
                vCreationData.CreateOption = this.CreateOption;
            }

            if (this.IsParameterBound(c => c.StorageAccountId))
            {
                if (vCreationData == null)
                {
                    vCreationData = new CreationData();
                }
                vCreationData.StorageAccountId = this.StorageAccountId;
            }

            if (this.IsParameterBound(c => c.ImageReference))
            {
                if (vCreationData == null)
                {
                    vCreationData = new CreationData();
                }
                vCreationData.ImageReference = this.ImageReference;
            }

            if (this.IsParameterBound(c => c.SourceUri))
            {
                if (vCreationData == null)
                {
                    vCreationData = new CreationData();
                }
                vCreationData.SourceUri = this.SourceUri;
            }

            if (this.IsParameterBound(c => c.SourceResourceId))
            {
                if (vCreationData == null)
                {
                    vCreationData = new CreationData();
                }
                vCreationData.SourceResourceId = this.SourceResourceId;
            }

            if (this.IsParameterBound(c => c.EncryptionSettingsEnabled))
            {
                if (vEncryptionSettingsCollection == null)
                {
                    vEncryptionSettingsCollection = new EncryptionSettingsCollection();
                }
                vEncryptionSettingsCollection.Enabled = (bool)this.EncryptionSettingsEnabled;
            }

            if (this.IsParameterBound(c => c.DiskEncryptionKey))
            {
                if (vEncryptionSettingsCollection == null)
                {
                    vEncryptionSettingsCollection = new EncryptionSettingsCollection();
                }

                if (vEncryptionSettingsCollection.EncryptionSettings == null)
                {
                    vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>();
                }

                if (vEncryptionSettingsCollection.EncryptionSettings.Count == 0)
                {
                    vEncryptionSettingsCollection.EncryptionSettings.Add(new EncryptionSettingsElement());
                }

                vEncryptionSettingsCollection.EncryptionSettings[0].DiskEncryptionKey = this.DiskEncryptionKey;
            }

            if (this.IsParameterBound(c => c.KeyEncryptionKey))
            {
                if (vEncryptionSettingsCollection == null)
                {
                    vEncryptionSettingsCollection = new EncryptionSettingsCollection();
                }

                if (vEncryptionSettingsCollection.EncryptionSettings == null)
                {
                    vEncryptionSettingsCollection.EncryptionSettings = new List <EncryptionSettingsElement>();
                }

                if (vEncryptionSettingsCollection.EncryptionSettings.Count == 0)
                {
                    vEncryptionSettingsCollection.EncryptionSettings.Add(new EncryptionSettingsElement());
                }

                vEncryptionSettingsCollection.EncryptionSettings[0].KeyEncryptionKey = this.KeyEncryptionKey;
            }

            if (this.IsParameterBound(c => c.DiskEncryptionSetId))
            {
                if (vEncryption == null)
                {
                    vEncryption = new Encryption();
                }
                vEncryption.DiskEncryptionSetId = this.DiskEncryptionSetId;
            }

            if (this.IsParameterBound(c => c.EncryptionType))
            {
                if (vEncryption == null)
                {
                    vEncryption = new Encryption();
                }
                vEncryption.Type = this.EncryptionType;
            }

            if (this.IsParameterBound(c => c.EdgeZone))
            {
                vExtendedLocation = new ExtendedLocation {
                    Name = this.EdgeZone, Type = ExtendedLocationTypes.EdgeZone
                };
            }

            var vSnapshot = new PSSnapshot
            {
                OsType           = this.IsParameterBound(c => c.OsType) ? this.OsType : (OperatingSystemTypes?)null,
                HyperVGeneration = this.IsParameterBound(c => c.HyperVGeneration) ? this.HyperVGeneration : null,
                DiskSizeGB       = this.IsParameterBound(c => c.DiskSizeGB) ? this.DiskSizeGB : (int?)null,
                Incremental      = this.Incremental.IsPresent,
                Location         = this.IsParameterBound(c => c.Location) ? this.Location : null,
                ExtendedLocation = vExtendedLocation,
                Tags             = this.IsParameterBound(c => c.Tag) ? this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value) : null,
                Sku          = vSku,
                CreationData = vCreationData,
                EncryptionSettingsCollection = vEncryptionSettingsCollection,
                Encryption          = vEncryption,
                NetworkAccessPolicy = this.IsParameterBound(c => c.NetworkAccessPolicy) ? this.NetworkAccessPolicy : null,
                DiskAccessId        = this.IsParameterBound(c => c.DiskAccessId) ? this.DiskAccessId : null,
                PurchasePlan        = this.IsParameterBound(c => c.PurchasePlan) ? this.PurchasePlan : null,
                SupportsHibernation = this.IsParameterBound(c => c.SupportsHibernation) ? SupportsHibernation : null
            };

            WriteObject(vSnapshot);
        }
 internal NetworkInterfaceData(string id, string name, string type, string location, IDictionary <string, string> tags, ExtendedLocation extendedLocation, string etag, WritableSubResource virtualMachine, NetworkSecurityGroupData networkSecurityGroup, PrivateEndpointData privateEndpoint, IList <NetworkInterfaceIPConfiguration> ipConfigurations, IReadOnlyList <NetworkInterfaceTapConfigurationData> tapConfigurations, NetworkInterfaceDnsSettings dnsSettings, string macAddress, bool?primary, bool?enableAcceleratedNetworking, bool?enableIPForwarding, IReadOnlyList <string> hostedWorkloads, WritableSubResource dscpConfiguration, string resourceGuid, ProvisioningState?provisioningState, string workloadType, NetworkInterfaceNicType?nicType, PrivateLinkServiceData privateLinkService, NetworkInterfaceMigrationPhase?migrationPhase) : base(id, name, type, location, tags)
 {
     ExtendedLocation            = extendedLocation;
     Etag                        = etag;
     VirtualMachine              = virtualMachine;
     NetworkSecurityGroup        = networkSecurityGroup;
     PrivateEndpoint             = privateEndpoint;
     IpConfigurations            = ipConfigurations;
     TapConfigurations           = tapConfigurations;
     DnsSettings                 = dnsSettings;
     MacAddress                  = macAddress;
     Primary                     = primary;
     EnableAcceleratedNetworking = enableAcceleratedNetworking;
     EnableIPForwarding          = enableIPForwarding;
     HostedWorkloads             = hostedWorkloads;
     DscpConfiguration           = dscpConfiguration;
     ResourceGuid                = resourceGuid;
     ProvisioningState           = provisioningState;
     WorkloadType                = workloadType;
     NicType                     = nicType;
     PrivateLinkService          = privateLinkService;
     MigrationPhase              = migrationPhase;
 }
 internal VirtualNetworkGatewayData(string id, string name, string type, string location, IDictionary <string, string> tags, ExtendedLocation extendedLocation, string etag, IList <VirtualNetworkGatewayIPConfiguration> ipConfigurations, VirtualNetworkGatewayType?gatewayType, VpnType?vpnType, VpnGatewayGeneration?vpnGatewayGeneration, bool?enableBgp, bool?enablePrivateIpAddress, bool?active, WritableSubResource gatewayDefaultSite, VirtualNetworkGatewaySku sku, VpnClientConfiguration vpnClientConfiguration, BgpSettings bgpSettings, AddressSpace customRoutes, string resourceGuid, ProvisioningState?provisioningState, bool?enableDnsForwarding, string inboundDnsForwardingEndpoint, string vNetExtendedLocationResourceId, IList <VirtualNetworkGatewayNatRuleData> natRules, bool?enableBgpRouteTranslationForNat) : base(id, name, type, location, tags)
 {
     ExtendedLocation       = extendedLocation;
     Etag                   = etag;
     IpConfigurations       = ipConfigurations;
     GatewayType            = gatewayType;
     VpnType                = vpnType;
     VpnGatewayGeneration   = vpnGatewayGeneration;
     EnableBgp              = enableBgp;
     EnablePrivateIpAddress = enablePrivateIpAddress;
     Active                 = active;
     GatewayDefaultSite     = gatewayDefaultSite;
     Sku = sku;
     VpnClientConfiguration         = vpnClientConfiguration;
     BgpSettings                    = bgpSettings;
     CustomRoutes                   = customRoutes;
     ResourceGuid                   = resourceGuid;
     ProvisioningState              = provisioningState;
     EnableDnsForwarding            = enableDnsForwarding;
     InboundDnsForwardingEndpoint   = inboundDnsForwardingEndpoint;
     VNetExtendedLocationResourceId = vNetExtendedLocationResourceId;
     NatRules = natRules;
     EnableBgpRouteTranslationForNat = enableBgpRouteTranslationForNat;
 }
 internal StorageAccountData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, Models.Sku sku, Kind?kind, ManagedServiceIdentity identity, ExtendedLocation extendedLocation, ProvisioningState?provisioningState, Endpoints primaryEndpoints, string primaryLocation, AccountStatus?statusOfPrimary, DateTimeOffset?lastGeoFailoverTime, string secondaryLocation, AccountStatus?statusOfSecondary, DateTimeOffset?creationTime, CustomDomain customDomain, SasPolicy sasPolicy, KeyPolicy keyPolicy, KeyCreationTime keyCreationTime, Endpoints secondaryEndpoints, Encryption encryption, AccessTier?accessTier, AzureFilesIdentityBasedAuthentication azureFilesIdentityBasedAuthentication, bool?enableHttpsTrafficOnly, NetworkRuleSet networkRuleSet, bool?isSftpEnabled, bool?isLocalUserEnabled, bool?isHnsEnabled, GeoReplicationStats geoReplicationStats, bool?failoverInProgress, LargeFileSharesState?largeFileSharesState, IReadOnlyList <PrivateEndpointConnectionData> privateEndpointConnections, RoutingPreference routingPreference, BlobRestoreStatus blobRestoreStatus, bool?allowBlobPublicAccess, MinimumTlsVersion?minimumTlsVersion, bool?allowSharedKeyAccess, bool?enableNfsV3, bool?allowCrossTenantReplication, bool?defaultToOAuthAuthentication, PublicNetworkAccess?publicNetworkAccess, ImmutableStorageAccount immutableStorageWithVersioning, AllowedCopyScope?allowedCopyScope) : base(id, name, type, systemData, tags, location)
 {
     Sku                 = sku;
     Kind                = kind;
     Identity            = identity;
     ExtendedLocation    = extendedLocation;
     ProvisioningState   = provisioningState;
     PrimaryEndpoints    = primaryEndpoints;
     PrimaryLocation     = primaryLocation;
     StatusOfPrimary     = statusOfPrimary;
     LastGeoFailoverTime = lastGeoFailoverTime;
     SecondaryLocation   = secondaryLocation;
     StatusOfSecondary   = statusOfSecondary;
     CreationTime        = creationTime;
     CustomDomain        = customDomain;
     SasPolicy           = sasPolicy;
     KeyPolicy           = keyPolicy;
     KeyCreationTime     = keyCreationTime;
     SecondaryEndpoints  = secondaryEndpoints;
     Encryption          = encryption;
     AccessTier          = accessTier;
     AzureFilesIdentityBasedAuthentication = azureFilesIdentityBasedAuthentication;
     EnableHttpsTrafficOnly     = enableHttpsTrafficOnly;
     NetworkRuleSet             = networkRuleSet;
     IsSftpEnabled              = isSftpEnabled;
     IsLocalUserEnabled         = isLocalUserEnabled;
     IsHnsEnabled               = isHnsEnabled;
     GeoReplicationStats        = geoReplicationStats;
     FailoverInProgress         = failoverInProgress;
     LargeFileSharesState       = largeFileSharesState;
     PrivateEndpointConnections = privateEndpointConnections;
     RoutingPreference          = routingPreference;
     BlobRestoreStatus          = blobRestoreStatus;
     AllowBlobPublicAccess      = allowBlobPublicAccess;
     MinimumTlsVersion          = minimumTlsVersion;
     AllowSharedKeyAccess       = allowSharedKeyAccess;
     EnableNfsV3 = enableNfsV3;
     AllowCrossTenantReplication    = allowCrossTenantReplication;
     DefaultToOAuthAuthentication   = defaultToOAuthAuthentication;
     PublicNetworkAccess            = publicNetworkAccess;
     ImmutableStorageWithVersioning = immutableStorageWithVersioning;
     AllowedCopyScope = allowedCopyScope;
 }
 internal KubeEnvironmentData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string kind, ExtendedLocation extendedLocation, KubeEnvironmentProvisioningState?provisioningState, string deploymentErrors, bool?internalLoadBalancerEnabled, string defaultDomain, string staticIp, ArcConfiguration arcConfiguration, AppLogsConfiguration appLogsConfiguration, string aksResourceID) : base(id, name, type, systemData, tags, location, kind)
 {
     ExtendedLocation            = extendedLocation;
     ProvisioningState           = provisioningState;
     DeploymentErrors            = deploymentErrors;
     InternalLoadBalancerEnabled = internalLoadBalancerEnabled;
     DefaultDomain        = defaultDomain;
     StaticIp             = staticIp;
     ArcConfiguration     = arcConfiguration;
     AppLogsConfiguration = appLogsConfiguration;
     AksResourceID        = aksResourceID;
 }
Example #6
0
        internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element)
        {
            Optional <Plan> plan = default;
            Optional <IReadOnlyList <VirtualMachineExtensionData> > resources = default;
            Optional <ResourceIdentity>  identity                                = default;
            Optional <IList <string> >   zones                                   = default;
            Optional <ExtendedLocation>  extendedLocation                        = default;
            IDictionary <string, string> tags                                    = default;
            Location                                     location                = default;
            ResourceIdentifier                           id                      = default;
            string                                       name                    = default;
            ResourceType                                 type                    = default;
            Optional <HardwareProfile>                   hardwareProfile         = default;
            Optional <StorageProfile>                    storageProfile          = default;
            Optional <AdditionalCapabilities>            additionalCapabilities  = default;
            Optional <OSProfile>                         osProfile               = default;
            Optional <NetworkProfile>                    networkProfile          = default;
            Optional <SecurityProfile>                   securityProfile         = default;
            Optional <DiagnosticsProfile>                diagnosticsProfile      = default;
            Optional <WritableSubResource>               availabilitySet         = default;
            Optional <WritableSubResource>               virtualMachineScaleSet  = default;
            Optional <WritableSubResource>               proximityPlacementGroup = default;
            Optional <VirtualMachinePriorityTypes>       priority                = default;
            Optional <VirtualMachineEvictionPolicyTypes> evictionPolicy          = default;
            Optional <BillingProfile>                    billingProfile          = default;
            Optional <WritableSubResource>               host                    = default;
            Optional <WritableSubResource>               hostGroup               = default;
            Optional <string>                            provisioningState       = default;
            Optional <VirtualMachineInstanceView>        instanceView            = default;
            Optional <string>                            licenseType             = default;
            Optional <string>                            vmId                    = default;
            Optional <string>                            extensionsTimeBudget    = default;
            Optional <int>                               platformFaultDomain     = default;
            Optional <ScheduledEventsProfile>            scheduledEventsProfile  = default;
            Optional <string>                            userData                = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("plan"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    plan = Plan.DeserializePlan(property.Value);
                    continue;
                }
                if (property.NameEquals("resources"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <VirtualMachineExtensionData> array = new List <VirtualMachineExtensionData>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(VirtualMachineExtensionData.DeserializeVirtualMachineExtensionData(item));
                    }
                    resources = array;
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = JsonSerializer.Deserialize <ResourceIdentity>(property.Value.ToString());
                    continue;
                }
                if (property.NameEquals("zones"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    zones = array;
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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 = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("hardwareProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("additionalCapabilities"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            additionalCapabilities = AdditionalCapabilities.DeserializeAdditionalCapabilities(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("osProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osProfile = OSProfile.DeserializeOSProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("networkProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("securityProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            securityProfile = SecurityProfile.DeserializeSecurityProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("diagnosticsProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            diagnosticsProfile = DiagnosticsProfile.DeserializeDiagnosticsProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("availabilitySet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            availabilitySet = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("virtualMachineScaleSet"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualMachineScaleSet = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("proximityPlacementGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            proximityPlacementGroup = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("priority"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            priority = new VirtualMachinePriorityTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("evictionPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            evictionPolicy = new VirtualMachineEvictionPolicyTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("billingProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            billingProfile = BillingProfile.DeserializeBillingProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("host"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            host = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("hostGroup"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hostGroup = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("instanceView"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            instanceView = VirtualMachineInstanceView.DeserializeVirtualMachineInstanceView(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("licenseType"))
                        {
                            licenseType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vmId"))
                        {
                            vmId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("extensionsTimeBudget"))
                        {
                            extensionsTimeBudget = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("platformFaultDomain"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            platformFaultDomain = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("scheduledEventsProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            scheduledEventsProfile = ScheduledEventsProfile.DeserializeScheduledEventsProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("userData"))
                        {
                            userData = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualMachineData(id, name, type, tags, location, plan.Value, Optional.ToList(resources), identity, Optional.ToList(zones), extendedLocation.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet, virtualMachineScaleSet, proximityPlacementGroup, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host, hostGroup, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value));
        }
        internal static ScVmmVirtualMachineData DeserializeScVmmVirtualMachineData(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>              vmmServerId     = default;
            Optional <string>              cloudId         = default;
            Optional <string>              templateId      = default;
            Optional <string>              checkpointType  = default;
            Optional <IList <Checkpoint> > checkpoints     = default;
            Optional <IList <AvailabilitySetListItem> > availabilitySets = default;
            Optional <OSProfile>       osProfile         = default;
            Optional <HardwareProfile> hardwareProfile   = default;
            Optional <NetworkProfile>  networkProfile    = default;
            Optional <StorageProfile>  storageProfile    = default;
            Optional <string>          vmName            = default;
            Optional <string>          uuid              = default;
            Optional <int>             generation        = default;
            Optional <string>          powerState        = 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 = 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 = 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("vmmServerId"))
                        {
                            vmmServerId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("cloudId"))
                        {
                            cloudId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("templateId"))
                        {
                            templateId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("checkpointType"))
                        {
                            checkpointType = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("checkpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <Checkpoint> array = new List <Checkpoint>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(Checkpoint.DeserializeCheckpoint(item));
                            }
                            checkpoints = array;
                            continue;
                        }
                        if (property0.NameEquals("availabilitySets"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <AvailabilitySetListItem> array = new List <AvailabilitySetListItem>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(AvailabilitySetListItem.DeserializeAvailabilitySetListItem(item));
                            }
                            availabilitySets = array;
                            continue;
                        }
                        if (property0.NameEquals("osProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            osProfile = OSProfile.DeserializeOSProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("hardwareProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            hardwareProfile = HardwareProfile.DeserializeHardwareProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("networkProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkProfile = NetworkProfile.DeserializeNetworkProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            storageProfile = StorageProfile.DeserializeStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("vmName"))
                        {
                            vmName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("uuid"))
                        {
                            uuid = 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("powerState"))
                        {
                            powerState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ScVmmVirtualMachineData(id, name, type, systemData, tags, location, extendedLocation, inventoryItemId.Value, vmmServerId.Value, cloudId.Value, templateId.Value, checkpointType.Value, Optional.ToList(checkpoints), Optional.ToList(availabilitySets), osProfile.Value, hardwareProfile.Value, networkProfile.Value, storageProfile.Value, vmName.Value, uuid.Value, Optional.ToNullable(generation), powerState.Value, provisioningState.Value));
        }
Example #8
0
 internal SnapshotData(ResourceIdentifier id, string name, ResourceType type, IDictionary <string, string> tags, AzureLocation location, string managedBy, SnapshotSku sku, ExtendedLocation extendedLocation, DateTimeOffset?timeCreated, OperatingSystemTypes?osType, HyperVGeneration?hyperVGeneration, PurchasePlanAutoGenerated purchasePlan, CreationData creationData, int?diskSizeGB, long?diskSizeBytes, DiskState?diskState, string uniqueId, EncryptionSettingsCollection encryptionSettingsCollection, string provisioningState, bool?incremental, Encryption encryption, NetworkAccessPolicy?networkAccessPolicy, string diskAccessId, bool?supportsHibernation) : base(id, name, type, tags, location)
 {
     ManagedBy                    = managedBy;
     Sku                          = sku;
     ExtendedLocation             = extendedLocation;
     TimeCreated                  = timeCreated;
     OsType                       = osType;
     HyperVGeneration             = hyperVGeneration;
     PurchasePlan                 = purchasePlan;
     CreationData                 = creationData;
     DiskSizeGB                   = diskSizeGB;
     DiskSizeBytes                = diskSizeBytes;
     DiskState                    = diskState;
     UniqueId                     = uniqueId;
     EncryptionSettingsCollection = encryptionSettingsCollection;
     ProvisioningState            = provisioningState;
     Incremental                  = incremental;
     Encryption                   = encryption;
     NetworkAccessPolicy          = networkAccessPolicy;
     DiskAccessId                 = diskAccessId;
     SupportsHibernation          = supportsHibernation;
 }
Example #9
0
 internal ScVmmCloudData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string cloudName, CloudCapacity cloudCapacity, IReadOnlyList <StorageQoSPolicy> storageQoSPolicies, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     ExtendedLocation   = extendedLocation;
     InventoryItemId    = inventoryItemId;
     Uuid               = uuid;
     VmmServerId        = vmmServerId;
     CloudName          = cloudName;
     CloudCapacity      = cloudCapacity;
     StorageQoSPolicies = storageQoSPolicies;
     ProvisioningState  = provisioningState;
 }
 internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, SystemAssignedServiceIdentity identity, string resourcePoolId, string templateId, string vCenterId, PlacementProfile placementProfile, OSProfile osProfile, HardwareProfile hardwareProfile, NetworkProfile networkProfile, StorageProfile storageProfile, GuestAgentProfile guestAgentProfile, string moRefId, string inventoryItemId, string moName, string folderPath, string instanceUuid, string smbiosUuid, FirmwareType?firmwareType, string powerState, string customResourceName, string uuid, IReadOnlyList <ResourceStatus> statuses, string provisioningState, string vmId) : base(id, name, type, systemData, tags, location)
 {
     ExtendedLocation   = extendedLocation;
     Kind               = kind;
     Identity           = identity;
     ResourcePoolId     = resourcePoolId;
     TemplateId         = templateId;
     VCenterId          = vCenterId;
     PlacementProfile   = placementProfile;
     OSProfile          = osProfile;
     HardwareProfile    = hardwareProfile;
     NetworkProfile     = networkProfile;
     StorageProfile     = storageProfile;
     GuestAgentProfile  = guestAgentProfile;
     MoRefId            = moRefId;
     InventoryItemId    = inventoryItemId;
     MoName             = moName;
     FolderPath         = folderPath;
     InstanceUuid       = instanceUuid;
     SmbiosUuid         = smbiosUuid;
     FirmwareType       = firmwareType;
     PowerState         = powerState;
     CustomResourceName = customResourceName;
     Uuid               = uuid;
     Statuses           = statuses;
     ProvisioningState  = provisioningState;
     VmId               = vmId;
 }
 internal PrivateLinkServiceData(string id, string name, string type, string location, IDictionary <string, string> tags, ExtendedLocation extendedLocation, string etag, IList <FrontendIPConfigurationData> loadBalancerFrontendIpConfigurations, IList <PrivateLinkServiceIpConfiguration> ipConfigurations, IReadOnlyList <NetworkInterfaceData> networkInterfaces, ProvisioningState?provisioningState, IReadOnlyList <PrivateEndpointConnectionData> privateEndpointConnections, PrivateLinkServicePropertiesVisibility visibility, PrivateLinkServicePropertiesAutoApproval autoApproval, IList <string> fqdns, string @alias, bool?enableProxyProtocol) : base(id, name, type, location, tags)
 {
     ExtendedLocation = extendedLocation;
     Etag             = etag;
     LoadBalancerFrontendIpConfigurations = loadBalancerFrontendIpConfigurations;
     IpConfigurations           = ipConfigurations;
     NetworkInterfaces          = networkInterfaces;
     ProvisioningState          = provisioningState;
     PrivateEndpointConnections = privateEndpointConnections;
     Visibility          = visibility;
     AutoApproval        = autoApproval;
     Fqdns               = fqdns;
     Alias               = @alias;
     EnableProxyProtocol = enableProxyProtocol;
 }
 internal WebSiteData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, string kind, ManagedServiceIdentity identity, ExtendedLocation extendedLocation, string state, IReadOnlyList <string> hostNames, string repositorySiteName, UsageState?usageState, bool?enabled, IReadOnlyList <string> enabledHostNames, SiteAvailabilityState?availabilityState, IList <HostNameSslState> hostNameSslStates, string serverFarmId, bool?reserved, bool?isXenon, bool?hyperV, DateTimeOffset?lastModifiedTimeUtc, SiteConfigProperties siteConfig, IReadOnlyList <string> trafficManagerHostNames, bool?scmSiteAlsoStopped, string targetSwapSlot, HostingEnvironmentProfile hostingEnvironmentProfile, bool?clientAffinityEnabled, bool?clientCertEnabled, ClientCertMode?clientCertMode, string clientCertExclusionPaths, bool?hostNamesDisabled, string customDomainVerificationId, string outboundIPAddresses, string possibleOutboundIPAddresses, int?containerSize, int?dailyMemoryTimeQuota, DateTimeOffset?suspendedTill, int?maxNumberOfWorkers, CloningInfo cloningInfo, string resourceGroup, bool?isDefaultContainer, string defaultHostName, SlotSwapStatus slotSwapStatus, bool?httpsOnly, RedundancyMode?redundancyMode, Guid?inProgressOperationId, bool?storageAccountRequired, string keyVaultReferenceIdentity, string virtualNetworkSubnetId) : base(id, name, resourceType, systemData, tags, location, kind)
 {
     Identity                    = identity;
     ExtendedLocation            = extendedLocation;
     State                       = state;
     HostNames                   = hostNames;
     RepositorySiteName          = repositorySiteName;
     UsageState                  = usageState;
     Enabled                     = enabled;
     EnabledHostNames            = enabledHostNames;
     AvailabilityState           = availabilityState;
     HostNameSslStates           = hostNameSslStates;
     ServerFarmId                = serverFarmId;
     Reserved                    = reserved;
     IsXenon                     = isXenon;
     HyperV                      = hyperV;
     LastModifiedTimeUtc         = lastModifiedTimeUtc;
     SiteConfig                  = siteConfig;
     TrafficManagerHostNames     = trafficManagerHostNames;
     ScmSiteAlsoStopped          = scmSiteAlsoStopped;
     TargetSwapSlot              = targetSwapSlot;
     HostingEnvironmentProfile   = hostingEnvironmentProfile;
     ClientAffinityEnabled       = clientAffinityEnabled;
     ClientCertEnabled           = clientCertEnabled;
     ClientCertMode              = clientCertMode;
     ClientCertExclusionPaths    = clientCertExclusionPaths;
     HostNamesDisabled           = hostNamesDisabled;
     CustomDomainVerificationId  = customDomainVerificationId;
     OutboundIPAddresses         = outboundIPAddresses;
     PossibleOutboundIPAddresses = possibleOutboundIPAddresses;
     ContainerSize               = containerSize;
     DailyMemoryTimeQuota        = dailyMemoryTimeQuota;
     SuspendedTill               = suspendedTill;
     MaxNumberOfWorkers          = maxNumberOfWorkers;
     CloningInfo                 = cloningInfo;
     ResourceGroup               = resourceGroup;
     IsDefaultContainer          = isDefaultContainer;
     DefaultHostName             = defaultHostName;
     SlotSwapStatus              = slotSwapStatus;
     HttpsOnly                   = httpsOnly;
     RedundancyMode              = redundancyMode;
     InProgressOperationId       = inProgressOperationId;
     StorageAccountRequired      = storageAccountRequired;
     KeyVaultReferenceIdentity   = keyVaultReferenceIdentity;
     VirtualNetworkSubnetId      = virtualNetworkSubnetId;
 }
Example #13
0
        internal static DiskAccessData DeserializeDiskAccessData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation = default;
            IDictionary <string, string> tags             = default;
            AzureLocation      location   = default;
            ResourceIdentifier id         = default;
            string             name       = default;
            ResourceType       type       = default;
            SystemData         systemData = default;
            Optional <IReadOnlyList <ComputePrivateEndpointConnectionData> > privateEndpointConnections = default;
            Optional <string>         provisioningState = default;
            Optional <DateTimeOffset> timeCreated       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ComputePrivateEndpointConnectionData> array = new List <ComputePrivateEndpointConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ComputePrivateEndpointConnectionData.DeserializeComputePrivateEndpointConnectionData(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("timeCreated"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            timeCreated = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new DiskAccessData(id, name, type, systemData, tags, location, extendedLocation.Value, Optional.ToList(privateEndpointConnections), provisioningState.Value, Optional.ToNullable(timeCreated)));
        }
Example #14
0
 public PSExtendedLocation(ExtendedLocation extendedLocation)
 {
     this.Name = extendedLocation.Name;
     this.Type = extendedLocation.Type;
 }
Example #15
0
 internal ScVmmVirtualNetworkData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string inventoryItemId, string uuid, string vmmServerId, string networkName, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     ExtendedLocation  = extendedLocation;
     InventoryItemId   = inventoryItemId;
     Uuid              = uuid;
     VmmServerId       = vmmServerId;
     NetworkName       = networkName;
     ProvisioningState = provisioningState;
 }
Example #16
0
        internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(JsonElement element)
        {
            Optional <ExtendedLocation> extendedLocation = default;
            Optional <string>           etag             = default;
            Optional <string>           id                = default;
            Optional <string>           name              = default;
            Optional <string>           type              = default;
            Optional <string>           location          = default;
            Optional <IDictionary <string, string> > tags = default;
            Optional <IList <VirtualNetworkGatewayIPConfiguration> > ipConfigurations = default;
            Optional <VirtualNetworkGatewayType> gatewayType = default;
            Optional <VpnType> vpnType = default;
            Optional <VpnGatewayGeneration> vpnGatewayGeneration = default;
            Optional <bool> enableBgp = default;
            Optional <bool> enablePrivateIpAddress = default;
            Optional <bool> activeActive           = default;
            Optional <WritableSubResource>      gatewayDefaultSite = default;
            Optional <VirtualNetworkGatewaySku> sku = default;
            Optional <VpnClientConfiguration>   vpnClientConfiguration = default;
            Optional <BgpSettings>       bgpSettings         = default;
            Optional <AddressSpace>      customRoutes        = default;
            Optional <string>            resourceGuid        = default;
            Optional <ProvisioningState> provisioningState   = default;
            Optional <bool>   enableDnsForwarding            = default;
            Optional <string> inboundDnsForwardingEndpoint   = default;
            Optional <string> vNetExtendedLocationResourceId = default;
            Optional <IList <VirtualNetworkGatewayNatRuleData> > natRules = default;
            Optional <bool> enableBgpRouteTranslationForNat = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("etag"))
                {
                    etag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("ipConfigurations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualNetworkGatewayIPConfiguration> array = new List <VirtualNetworkGatewayIPConfiguration>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkGatewayIPConfiguration.DeserializeVirtualNetworkGatewayIPConfiguration(item));
                            }
                            ipConfigurations = array;
                            continue;
                        }
                        if (property0.NameEquals("gatewayType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            gatewayType = new VirtualNetworkGatewayType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("vpnType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vpnType = new VpnType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("vpnGatewayGeneration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vpnGatewayGeneration = new VpnGatewayGeneration(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("enableBgp"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableBgp = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("enablePrivateIpAddress"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enablePrivateIpAddress = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("activeActive"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            activeActive = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("gatewayDefaultSite"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            gatewayDefaultSite = JsonSerializer.Deserialize <WritableSubResource>(property0.Value.ToString());
                            continue;
                        }
                        if (property0.NameEquals("sku"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sku = VirtualNetworkGatewaySku.DeserializeVirtualNetworkGatewaySku(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("vpnClientConfiguration"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            vpnClientConfiguration = VpnClientConfiguration.DeserializeVpnClientConfiguration(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("bgpSettings"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            bgpSettings = BgpSettings.DeserializeBgpSettings(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("customRoutes"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customRoutes = AddressSpace.DeserializeAddressSpace(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("resourceGuid"))
                        {
                            resourceGuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = new ProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("enableDnsForwarding"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableDnsForwarding = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("inboundDnsForwardingEndpoint"))
                        {
                            inboundDnsForwardingEndpoint = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vNetExtendedLocationResourceId"))
                        {
                            vNetExtendedLocationResourceId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("natRules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <VirtualNetworkGatewayNatRuleData> array = new List <VirtualNetworkGatewayNatRuleData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(VirtualNetworkGatewayNatRuleData.DeserializeVirtualNetworkGatewayNatRuleData(item));
                            }
                            natRules = array;
                            continue;
                        }
                        if (property0.NameEquals("enableBgpRouteTranslationForNat"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            enableBgpRouteTranslationForNat = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VirtualNetworkGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(gatewayType), Optional.ToNullable(vpnType), Optional.ToNullable(vpnGatewayGeneration), Optional.ToNullable(enableBgp), Optional.ToNullable(enablePrivateIpAddress), Optional.ToNullable(activeActive), gatewayDefaultSite, sku.Value, vpnClientConfiguration.Value, bgpSettings.Value, customRoutes.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDnsForwarding), inboundDnsForwardingEndpoint.Value, vNetExtendedLocationResourceId.Value, Optional.ToList(natRules), Optional.ToNullable(enableBgpRouteTranslationForNat)));
        }
Example #17
0
        internal static ScVmmVirtualNetworkData DeserializeScVmmVirtualNetworkData(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 <string>  networkName       = 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("networkName"))
                        {
                            networkName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ScVmmVirtualNetworkData(id, name, type, systemData, tags, location, extendedLocation, inventoryItemId.Value, uuid.Value, vmmServerId.Value, networkName.Value, provisioningState.Value));
        }
Example #18
0
 internal VMwareClusterData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, IReadOnlyList <ResourceStatus> statuses, string customResourceName, IReadOnlyList <string> datastoreIds, IReadOnlyList <string> networkIds, string provisioningState) : base(id, name, resourceType, systemData, tags, location)
 {
     ExtendedLocation   = extendedLocation;
     Kind               = kind;
     Uuid               = uuid;
     VCenterId          = vCenterId;
     MoRefId            = moRefId;
     InventoryItemId    = inventoryItemId;
     MoName             = moName;
     Statuses           = statuses;
     CustomResourceName = customResourceName;
     DatastoreIds       = datastoreIds;
     NetworkIds         = networkIds;
     ProvisioningState  = provisioningState;
 }
        internal static VCenterData DeserializeVCenterData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation = default;
            Optional <string>            kind             = default;
            IDictionary <string, string> tags             = default;
            AzureLocation           location                    = default;
            ResourceIdentifier      id                          = default;
            string                  name                        = default;
            ResourceType            type                        = default;
            SystemData              systemData                  = default;
            Optional <string>       uuid                        = default;
            string                  fqdn                        = default;
            Optional <int>          port                        = default;
            Optional <string>       version                     = default;
            Optional <string>       instanceUuid                = default;
            Optional <string>       connectionStatus            = default;
            Optional <string>       customResourceName          = default;
            Optional <VICredential> credentials                 = default;
            Optional <IReadOnlyList <ResourceStatus> > statuses = default;
            Optional <string> provisioningState                 = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    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 = 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 = 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("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("fqdn"))
                        {
                            fqdn = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("port"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            port = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("version"))
                        {
                            version = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("instanceUuid"))
                        {
                            instanceUuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("connectionStatus"))
                        {
                            connectionStatus = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("customResourceName"))
                        {
                            customResourceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("credentials"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            credentials = VICredential.DeserializeVICredential(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("statuses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ResourceStatus> array = new List <ResourceStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ResourceStatus.DeserializeResourceStatus(item));
                            }
                            statuses = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VCenterData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, uuid.Value, fqdn, Optional.ToNullable(port), version.Value, instanceUuid.Value, connectionStatus.Value, customResourceName.Value, credentials.Value, Optional.ToList(statuses), provisioningState.Value));
        }
        internal static StorageAccountData DeserializeStorageAccountData(JsonElement element)
        {
            Optional <Models.Sku>        sku              = default;
            Optional <Kind>              kind             = default;
            Optional <Identity>          identity         = default;
            Optional <ExtendedLocation>  extendedLocation = default;
            IDictionary <string, string> tags             = default;
            Location                     location         = default;
            ResourceIdentifier           id   = default;
            string                       name = default;
            ResourceType                 type = default;
            Optional <ProvisioningState> provisioningState   = default;
            Optional <Endpoints>         primaryEndpoints    = default;
            Optional <string>            primaryLocation     = default;
            Optional <AccountStatus>     statusOfPrimary     = default;
            Optional <DateTimeOffset>    lastGeoFailoverTime = default;
            Optional <string>            secondaryLocation   = default;
            Optional <AccountStatus>     statusOfSecondary   = default;
            Optional <DateTimeOffset>    creationTime        = default;
            Optional <CustomDomain>      customDomain        = default;
            Optional <SasPolicy>         sasPolicy           = default;
            Optional <KeyPolicy>         keyPolicy           = default;
            Optional <KeyCreationTime>   keyCreationTime     = default;
            Optional <Endpoints>         secondaryEndpoints  = default;
            Optional <Encryption>        encryption          = default;
            Optional <AccessTier>        accessTier          = default;
            Optional <AzureFilesIdentityBasedAuthentication> azureFilesIdentityBasedAuthentication = default;
            Optional <bool>                 supportsHttpsTrafficOnly = default;
            Optional <NetworkRuleSet>       networkAcls          = default;
            Optional <bool>                 isHnsEnabled         = default;
            Optional <GeoReplicationStats>  geoReplicationStats  = default;
            Optional <bool>                 failoverInProgress   = default;
            Optional <LargeFileSharesState> largeFileSharesState = default;
            Optional <IReadOnlyList <PrivateEndpointConnectionData> > privateEndpointConnections = default;
            Optional <RoutingPreference> routingPreference = default;
            Optional <BlobRestoreStatus> blobRestoreStatus = default;
            Optional <bool> allowBlobPublicAccess          = default;
            Optional <MinimumTlsVersion> minimumTlsVersion = default;
            Optional <bool> allowSharedKeyAccess           = default;
            Optional <bool> isNfsV3Enabled = default;
            Optional <bool> allowCrossTenantReplication = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("sku"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    sku = Models.Sku.DeserializeSku(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    kind = new Kind(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = Identity.DeserializeIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    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 = 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 = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningState = property0.Value.GetString().ToProvisioningState();
                            continue;
                        }
                        if (property0.NameEquals("primaryEndpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            primaryEndpoints = Endpoints.DeserializeEndpoints(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("primaryLocation"))
                        {
                            primaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statusOfPrimary"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statusOfPrimary = property0.Value.GetString().ToAccountStatus();
                            continue;
                        }
                        if (property0.NameEquals("lastGeoFailoverTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            lastGeoFailoverTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("secondaryLocation"))
                        {
                            secondaryLocation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statusOfSecondary"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            statusOfSecondary = property0.Value.GetString().ToAccountStatus();
                            continue;
                        }
                        if (property0.NameEquals("creationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("customDomain"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            customDomain = CustomDomain.DeserializeCustomDomain(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("sasPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sasPolicy = SasPolicy.DeserializeSasPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("keyPolicy"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keyPolicy = KeyPolicy.DeserializeKeyPolicy(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("keyCreationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            keyCreationTime = KeyCreationTime.DeserializeKeyCreationTime(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("secondaryEndpoints"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            secondaryEndpoints = Endpoints.DeserializeEndpoints(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("encryption"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            encryption = Encryption.DeserializeEncryption(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("accessTier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            accessTier = property0.Value.GetString().ToAccessTier();
                            continue;
                        }
                        if (property0.NameEquals("azureFilesIdentityBasedAuthentication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            azureFilesIdentityBasedAuthentication = AzureFilesIdentityBasedAuthentication.DeserializeAzureFilesIdentityBasedAuthentication(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("supportsHttpsTrafficOnly"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            supportsHttpsTrafficOnly = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("networkAcls"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            networkAcls = NetworkRuleSet.DeserializeNetworkRuleSet(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("isHnsEnabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isHnsEnabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("geoReplicationStats"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            geoReplicationStats = GeoReplicationStats.DeserializeGeoReplicationStats(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("failoverInProgress"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            failoverInProgress = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("largeFileSharesState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            largeFileSharesState = new LargeFileSharesState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("privateEndpointConnections"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <PrivateEndpointConnectionData> array = new List <PrivateEndpointConnectionData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(PrivateEndpointConnectionData.DeserializePrivateEndpointConnectionData(item));
                            }
                            privateEndpointConnections = array;
                            continue;
                        }
                        if (property0.NameEquals("routingPreference"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            routingPreference = RoutingPreference.DeserializeRoutingPreference(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("blobRestoreStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            blobRestoreStatus = BlobRestoreStatus.DeserializeBlobRestoreStatus(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("allowBlobPublicAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowBlobPublicAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("minimumTlsVersion"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            minimumTlsVersion = new MinimumTlsVersion(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("allowSharedKeyAccess"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowSharedKeyAccess = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("isNfsV3Enabled"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isNfsV3Enabled = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("allowCrossTenantReplication"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            allowCrossTenantReplication = property0.Value.GetBoolean();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new StorageAccountData(id, name, type, tags, location, sku.Value, Optional.ToNullable(kind), identity.Value, extendedLocation.Value, Optional.ToNullable(provisioningState), primaryEndpoints.Value, primaryLocation.Value, Optional.ToNullable(statusOfPrimary), Optional.ToNullable(lastGeoFailoverTime), secondaryLocation.Value, Optional.ToNullable(statusOfSecondary), Optional.ToNullable(creationTime), customDomain.Value, sasPolicy.Value, keyPolicy.Value, keyCreationTime.Value, secondaryEndpoints.Value, encryption.Value, Optional.ToNullable(accessTier), azureFilesIdentityBasedAuthentication.Value, Optional.ToNullable(supportsHttpsTrafficOnly), networkAcls.Value, Optional.ToNullable(isHnsEnabled), geoReplicationStats.Value, Optional.ToNullable(failoverInProgress), Optional.ToNullable(largeFileSharesState), Optional.ToList(privateEndpointConnections), routingPreference.Value, blobRestoreStatus.Value, Optional.ToNullable(allowBlobPublicAccess), Optional.ToNullable(minimumTlsVersion), Optional.ToNullable(allowSharedKeyAccess), Optional.ToNullable(isNfsV3Enabled), Optional.ToNullable(allowCrossTenantReplication)));
        }
Example #21
0
 internal ResourcePoolData(ResourceIdentifier id, string name, ResourceType type, SystemData systemData, IDictionary <string, string> tags, AzureLocation location, ExtendedLocation extendedLocation, string kind, string uuid, string vCenterId, string moRefId, string inventoryItemId, string moName, string cpuSharesLevel, long?cpuReservationMHz, long?cpuLimitMHz, string memSharesLevel, long?memReservationMB, long?memLimitMB, string customResourceName, IReadOnlyList <ResourceStatus> statuses, string provisioningState) : base(id, name, type, systemData, tags, location)
 {
     ExtendedLocation   = extendedLocation;
     Kind               = kind;
     Uuid               = uuid;
     VCenterId          = vCenterId;
     MoRefId            = moRefId;
     InventoryItemId    = inventoryItemId;
     MoName             = moName;
     CpuSharesLevel     = cpuSharesLevel;
     CpuReservationMHz  = cpuReservationMHz;
     CpuLimitMHz        = cpuLimitMHz;
     MemSharesLevel     = memSharesLevel;
     MemReservationMB   = memReservationMB;
     MemLimitMB         = memLimitMB;
     CustomResourceName = customResourceName;
     Statuses           = statuses;
     ProvisioningState  = provisioningState;
 }
Example #22
0
        internal static VMwareClusterData DeserializeVMwareClusterData(JsonElement element)
        {
            Optional <ExtendedLocation>  extendedLocation = default;
            Optional <string>            kind             = default;
            IDictionary <string, string> tags             = default;
            AzureLocation      location        = default;
            ResourceIdentifier id              = default;
            string             name            = default;
            ResourceType       type            = default;
            SystemData         systemData      = default;
            Optional <string>  uuid            = default;
            Optional <string>  vCenterId       = default;
            Optional <string>  moRefId         = default;
            Optional <string>  inventoryItemId = default;
            Optional <string>  moName          = default;
            Optional <IReadOnlyList <ResourceStatus> > statuses = default;
            Optional <string> customResourceName            = default;
            Optional <IReadOnlyList <string> > datastoreIds = default;
            Optional <IReadOnlyList <string> > networkIds   = default;
            Optional <string> provisioningState             = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("extendedLocation"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    extendedLocation = ExtendedLocation.DeserializeExtendedLocation(property.Value);
                    continue;
                }
                if (property.NameEquals("kind"))
                {
                    kind = property.Value.GetString();
                    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 = 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 = 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("uuid"))
                        {
                            uuid = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("vCenterId"))
                        {
                            vCenterId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("moRefId"))
                        {
                            moRefId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("inventoryItemId"))
                        {
                            inventoryItemId = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("moName"))
                        {
                            moName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("statuses"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ResourceStatus> array = new List <ResourceStatus>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ResourceStatus.DeserializeResourceStatus(item));
                            }
                            statuses = array;
                            continue;
                        }
                        if (property0.NameEquals("customResourceName"))
                        {
                            customResourceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("datastoreIds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            datastoreIds = array;
                            continue;
                        }
                        if (property0.NameEquals("networkIds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <string> array = new List <string>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(item.GetString());
                            }
                            networkIds = array;
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new VMwareClusterData(id, name, type, systemData, tags, location, extendedLocation.Value, kind.Value, uuid.Value, vCenterId.Value, moRefId.Value, inventoryItemId.Value, moName.Value, Optional.ToList(statuses), customResourceName.Value, Optional.ToList(datastoreIds), Optional.ToList(networkIds), provisioningState.Value));
        }