示例#1
0
 internal ContainerInstanceVolume(string name, AzureFileVolume azureFile, BinaryData emptyDir, IDictionary <string, string> secret, GitRepoVolume gitRepo)
 {
     Name      = name;
     AzureFile = azureFile;
     EmptyDir  = emptyDir;
     Secret    = secret;
     GitRepo   = gitRepo;
 }
示例#2
0
        internal static ContainerInstanceVolume DeserializeContainerInstanceVolume(JsonElement element)
        {
            string name = default;
            Optional <AzureFileVolume> azureFile            = default;
            Optional <BinaryData>      emptyDir             = default;
            Optional <IDictionary <string, string> > secret = default;
            Optional <GitRepoVolume> gitRepo = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("name"))
                {
                    name = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("azureFile"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    azureFile = AzureFileVolume.DeserializeAzureFileVolume(property.Value);
                    continue;
                }
                if (property.NameEquals("emptyDir"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    emptyDir = BinaryData.FromString(property.Value.GetRawText());
                    continue;
                }
                if (property.NameEquals("secret"))
                {
                    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());
                    }
                    secret = dictionary;
                    continue;
                }
                if (property.NameEquals("gitRepo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    gitRepo = GitRepoVolume.DeserializeGitRepoVolume(property.Value);
                    continue;
                }
            }
            return(new ContainerInstanceVolume(name, azureFile.Value, emptyDir.Value, Optional.ToDictionary(secret), gitRepo.Value));
        }