예제 #1
0
        public PSRestorableLocationResource(RestorableLocationResource restorableLocationResource)
        {
            if (restorableLocationResource == null)
            {
                return;
            }

            LocationName = restorableLocationResource.LocationName;
            RegionalDatabaseAccountInstanceId = restorableLocationResource.RegionalDatabaseAccountInstanceId;
            CreationTime = restorableLocationResource.CreationTime;
            DeletionTime = restorableLocationResource.DeletionTime;
        }
예제 #2
0
        internal static RestorableDatabaseAccountData DeserializeRestorableDatabaseAccountData(JsonElement element)
        {
            Optional <string>         location     = default;
            ResourceIdentifier        id           = default;
            string                    name         = default;
            ResourceType              type         = default;
            SystemData                systemData   = default;
            Optional <string>         accountName  = default;
            Optional <DateTimeOffset> creationTime = default;
            Optional <DateTimeOffset> deletionTime = default;
            Optional <ApiType>        apiType      = default;
            Optional <IReadOnlyList <RestorableLocationResource> > restorableLocations = default;

            foreach (var property in element.EnumerateObject())
            {
                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 = 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("accountName"))
                        {
                            accountName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("creationTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            creationTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("deletionTime"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            deletionTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("apiType"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            apiType = new ApiType(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("restorableLocations"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <RestorableLocationResource> array = new List <RestorableLocationResource>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(RestorableLocationResource.DeserializeRestorableLocationResource(item));
                            }
                            restorableLocations = array;
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new RestorableDatabaseAccountData(id, name, type, systemData, location.Value, accountName.Value, Optional.ToNullable(creationTime), Optional.ToNullable(deletionTime), Optional.ToNullable(apiType), Optional.ToList(restorableLocations)));
        }