예제 #1
0
 internal GalleryImageVersion(string id, string name, string type, string location, IDictionary <string, string> tags, GalleryArtifactPublishingProfileBase publishingProfile, GalleryImageVersionPropertiesProvisioningState?provisioningState, GalleryImageVersionStorageProfile storageProfile, ReplicationStatus replicationStatus) : base(id, name, type, location, tags)
 {
     PublishingProfile = publishingProfile;
     ProvisioningState = provisioningState;
     StorageProfile    = storageProfile;
     ReplicationStatus = replicationStatus;
 }
        internal static GalleryImageVersion DeserializeGalleryImageVersion(JsonElement element)
        {
            string id       = default;
            string name     = default;
            string type     = default;
            string location = default;
            IDictionary <string, string>                   tags = default;
            GalleryArtifactPublishingProfileBase           publishingProfile = default;
            GalleryImageVersionPropertiesProvisioningState?provisioningState = default;
            GalleryImageVersionStorageProfile              storageProfile    = default;
            ReplicationStatus replicationStatus = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("name"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("type"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    type = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("location"))
                {
                    location = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("tags"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    Dictionary <string, string> dictionary = new Dictionary <string, string>();
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.Value.ValueKind == JsonValueKind.Null)
                        {
                            dictionary.Add(property0.Name, null);
                        }
                        else
                        {
                            dictionary.Add(property0.Name, property0.Value.GetString());
                        }
                    }
                    tags = dictionary;
                    continue;
                }
                if (property.NameEquals("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("publishingProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            publishingProfile = GalleryArtifactPublishingProfileBase.DeserializeGalleryArtifactPublishingProfileBase(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            provisioningState = new GalleryImageVersionPropertiesProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("storageProfile"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            storageProfile = GalleryImageVersionStorageProfile.DeserializeGalleryImageVersionStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("replicationStatus"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                continue;
                            }
                            replicationStatus = ReplicationStatus.DeserializeReplicationStatus(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new GalleryImageVersion(id, name, type, location, tags, publishingProfile, provisioningState, storageProfile, replicationStatus));
        }
예제 #3
0
        internal static GalleryImageVersion DeserializeGalleryImageVersion(JsonElement element)
        {
            Optional <string> id       = default;
            Optional <string> name     = default;
            Optional <string> type     = default;
            string            location = default;
            Optional <IDictionary <string, string> >                  tags = default;
            Optional <GalleryArtifactPublishingProfileBase>           publishingProfile = default;
            Optional <GalleryImageVersionPropertiesProvisioningState> provisioningState = default;
            Optional <GalleryImageVersionStorageProfile>              storageProfile    = default;
            Optional <ReplicationStatus> replicationStatus = 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("location"))
                {
                    location = 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("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("publishingProfile"))
                        {
                            publishingProfile = GalleryArtifactPublishingProfileBase.DeserializeGalleryArtifactPublishingProfileBase(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("provisioningState"))
                        {
                            provisioningState = new GalleryImageVersionPropertiesProvisioningState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("storageProfile"))
                        {
                            storageProfile = GalleryImageVersionStorageProfile.DeserializeGalleryImageVersionStorageProfile(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("replicationStatus"))
                        {
                            replicationStatus = ReplicationStatus.DeserializeReplicationStatus(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new GalleryImageVersion(id.Value, name.Value, type.Value, location, Optional.ToDictionary(tags), publishingProfile.Value, Optional.ToNullable(provisioningState), storageProfile.Value, replicationStatus.Value));
        }