Esempio n. 1
0
 internal SiteProcessModule(ArmResource options, ProcessModuleInfoData resource) : base(options, resource.Id)
 {
     HasData            = true;
     _data              = resource;
     _clientDiagnostics = new ClientDiagnostics(ClientOptions);
     _webAppsRestClient = new WebAppsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri);
 }
 internal SiteProcessModule(ArmClient client, ProcessModuleInfoData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }
        internal static ProcessInfoData DeserializeProcessInfoData(JsonElement element)
        {
            Optional <string>                         kind                       = default;
            ResourceIdentifier                        id                         = default;
            string                                    name                       = default;
            ResourceType                              type                       = default;
            SystemData                                systemData                 = default;
            Optional <int>                            identifier                 = default;
            Optional <string>                         deploymentName             = default;
            Optional <string>                         href                       = default;
            Optional <string>                         minidump                   = default;
            Optional <bool>                           isProfileRunning           = default;
            Optional <bool>                           isIisProfileRunning        = default;
            Optional <double>                         iisProfileTimeoutInSeconds = default;
            Optional <string>                         parent                     = default;
            Optional <IList <string> >                children                   = default;
            Optional <IList <ProcessThreadInfo> >     threads                    = default;
            Optional <IList <string> >                openFileHandles            = default;
            Optional <IList <ProcessModuleInfoData> > modules                    = default;
            Optional <string>                         fileName                   = default;
            Optional <string>                         commandLine                = default;
            Optional <string>                         userName                   = default;
            Optional <int>                            handleCount                = default;
            Optional <int>                            moduleCount                = default;
            Optional <int>                            threadCount                = default;
            Optional <DateTimeOffset>                 startTime                  = default;
            Optional <string>                         totalCpuTime               = default;
            Optional <string>                         userCpuTime                = default;
            Optional <string>                         privilegedCpuTime          = default;
            Optional <long>                           workingSet                 = default;
            Optional <long>                           peakWorkingSet             = default;
            Optional <long>                           privateMemory              = default;
            Optional <long>                           virtualMemory              = default;
            Optional <long>                           peakVirtualMemory          = default;
            Optional <long>                           pagedSystemMemory          = default;
            Optional <long>                           nonPagedSystemMemory       = default;
            Optional <long>                           pagedMemory                = default;
            Optional <long>                           peakPagedMemory            = default;
            Optional <DateTimeOffset>                 timeStamp                  = default;
            Optional <IDictionary <string, string> >  environmentVariables       = default;
            Optional <bool>                           isScmSite                  = default;
            Optional <bool>                           isWebjob                   = default;
            Optional <string>                         description                = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("kind"))
                {
                    kind = 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("identifier"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            identifier = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("deployment_name"))
                        {
                            deploymentName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("href"))
                        {
                            href = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("minidump"))
                        {
                            minidump = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("is_profile_running"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isProfileRunning = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("is_iis_profile_running"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isIisProfileRunning = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("iis_profile_timeout_in_seconds"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            iisProfileTimeoutInSeconds = property0.Value.GetDouble();
                            continue;
                        }
                        if (property0.NameEquals("parent"))
                        {
                            parent = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("children"))
                        {
                            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());
                            }
                            children = array;
                            continue;
                        }
                        if (property0.NameEquals("threads"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ProcessThreadInfo> array = new List <ProcessThreadInfo>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ProcessThreadInfo.DeserializeProcessThreadInfo(item));
                            }
                            threads = array;
                            continue;
                        }
                        if (property0.NameEquals("open_file_handles"))
                        {
                            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());
                            }
                            openFileHandles = array;
                            continue;
                        }
                        if (property0.NameEquals("modules"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            List <ProcessModuleInfoData> array = new List <ProcessModuleInfoData>();
                            foreach (var item in property0.Value.EnumerateArray())
                            {
                                array.Add(ProcessModuleInfoData.DeserializeProcessModuleInfoData(item));
                            }
                            modules = array;
                            continue;
                        }
                        if (property0.NameEquals("file_name"))
                        {
                            fileName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("command_line"))
                        {
                            commandLine = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("user_name"))
                        {
                            userName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("handle_count"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            handleCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("module_count"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            moduleCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("thread_count"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            threadCount = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("start_time"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            startTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("total_cpu_time"))
                        {
                            totalCpuTime = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("user_cpu_time"))
                        {
                            userCpuTime = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("privileged_cpu_time"))
                        {
                            privilegedCpuTime = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("working_set"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            workingSet = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("peak_working_set"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peakWorkingSet = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("private_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            privateMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("virtual_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            virtualMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("peak_virtual_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peakVirtualMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("paged_system_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            pagedSystemMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("non_paged_system_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            nonPagedSystemMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("paged_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            pagedMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("peak_paged_memory"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            peakPagedMemory = property0.Value.GetInt64();
                            continue;
                        }
                        if (property0.NameEquals("time_stamp"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            timeStamp = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("environment_variables"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            Dictionary <string, string> dictionary = new Dictionary <string, string>();
                            foreach (var property1 in property0.Value.EnumerateObject())
                            {
                                dictionary.Add(property1.Name, property1.Value.GetString());
                            }
                            environmentVariables = dictionary;
                            continue;
                        }
                        if (property0.NameEquals("is_scm_site"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isScmSite = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("is_webjob"))
                        {
                            if (property0.Value.ValueKind == JsonValueKind.Null)
                            {
                                property0.ThrowNonNullablePropertyIsNull();
                                continue;
                            }
                            isWebjob = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ProcessInfoData(id, name, type, systemData, kind.Value, Optional.ToNullable(identifier), deploymentName.Value, href.Value, minidump.Value, Optional.ToNullable(isProfileRunning), Optional.ToNullable(isIisProfileRunning), Optional.ToNullable(iisProfileTimeoutInSeconds), parent.Value, Optional.ToList(children), Optional.ToList(threads), Optional.ToList(openFileHandles), Optional.ToList(modules), fileName.Value, commandLine.Value, userName.Value, Optional.ToNullable(handleCount), Optional.ToNullable(moduleCount), Optional.ToNullable(threadCount), Optional.ToNullable(startTime), totalCpuTime.Value, userCpuTime.Value, privilegedCpuTime.Value, Optional.ToNullable(workingSet), Optional.ToNullable(peakWorkingSet), Optional.ToNullable(privateMemory), Optional.ToNullable(virtualMemory), Optional.ToNullable(peakVirtualMemory), Optional.ToNullable(pagedSystemMemory), Optional.ToNullable(nonPagedSystemMemory), Optional.ToNullable(pagedMemory), Optional.ToNullable(peakPagedMemory), Optional.ToNullable(timeStamp), Optional.ToDictionary(environmentVariables), Optional.ToNullable(isScmSite), Optional.ToNullable(isWebjob), description.Value));
        }
 internal SiteSlotInstanceProcessModuleResource(ArmClient client, ProcessModuleInfoData data) : this(client, data.Id)
 {
     HasData = true;
     _data   = data;
 }