コード例 #1
0
 internal RestorePointData(ResourceIdentifier id, string name, ResourceType type, IList <ApiEntityReference> excludeDisks, RestorePointSourceMetadata sourceMetadata, string provisioningState, ConsistencyModeTypes?consistencyMode, RestorePointProvisioningDetails provisioningDetails) : base(id, name, type)
 {
     ExcludeDisks        = excludeDisks;
     SourceMetadata      = sourceMetadata;
     ProvisioningState   = provisioningState;
     ConsistencyMode     = consistencyMode;
     ProvisioningDetails = provisioningDetails;
 }
コード例 #2
0
        internal static RestorePointData DeserializeRestorePointData(JsonElement element)
        {
            ResourceIdentifier id   = default;
            string             name = default;
            ResourceType       type = default;
            Optional <IList <WritableSubResource> > excludeDisks   = default;
            Optional <RestorePointSourceMetadata>   sourceMetadata = default;
            Optional <string> provisioningState = default;
            Optional <ConsistencyModeTypes>            consistencyMode     = default;
            Optional <RestorePointProvisioningDetails> provisioningDetails = default;

            foreach (var property in element.EnumerateObject())
            {
                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("excludeDisks"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <WritableSubResource> array = new List <WritableSubResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(JsonSerializer.Deserialize <WritableSubResource>(item.ToString()));
                            }
                            excludeDisks = array;
                            continue;
                        }
                        if (property0.NameEquals("sourceMetadata"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            sourceMetadata = RestorePointSourceMetadata.DeserializeRestorePointSourceMetadata(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("consistencyMode"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            consistencyMode = new ConsistencyModeTypes(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("provisioningDetails"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            provisioningDetails = RestorePointProvisioningDetails.DeserializeRestorePointProvisioningDetails(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RestorePointData(id, name, type, Optional.ToList(excludeDisks), sourceMetadata.Value, provisioningState.Value, Optional.ToNullable(consistencyMode), provisioningDetails.Value));
        }