< Summary

Class:Microsoft.Azure.Batch.Protocol.Models.ComputeNodeStateEnumExtension
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\GeneratedProtocol\Models\ComputeNodeState.cs
Covered lines:0
Uncovered lines:29
Coverable lines:29
Total lines:176
Line coverage:0% (0 of 29)
Covered branches:0
Total branches:76
Branch coverage:0% (0 of 76)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToSerializedValue(...)-0%0%
ToSerializedValue(...)-0%0%
ParseComputeNodeState(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\GeneratedProtocol\Models\ComputeNodeState.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.Batch.Protocol.Models
 12{
 13    using Newtonsoft.Json;
 14    using Newtonsoft.Json.Converters;
 15    using System.Runtime;
 16    using System.Runtime.Serialization;
 17
 18    /// <summary>
 19    /// Defines values for ComputeNodeState.
 20    /// </summary>
 21    [JsonConverter(typeof(StringEnumConverter))]
 22    public enum ComputeNodeState
 23    {
 24        /// <summary>
 25        /// The Compute Node is not currently running a Task.
 26        /// </summary>
 27        [EnumMember(Value = "idle")]
 28        Idle,
 29        /// <summary>
 30        /// The Compute Node is rebooting.
 31        /// </summary>
 32        [EnumMember(Value = "rebooting")]
 33        Rebooting,
 34        /// <summary>
 35        /// The Compute Node is reimaging.
 36        /// </summary>
 37        [EnumMember(Value = "reimaging")]
 38        Reimaging,
 39        /// <summary>
 40        /// The Compute Node is running one or more Tasks (other than a
 41        /// StartTask).
 42        /// </summary>
 43        [EnumMember(Value = "running")]
 44        Running,
 45        /// <summary>
 46        /// The Compute Node cannot be used for Task execution due to errors.
 47        /// </summary>
 48        [EnumMember(Value = "unusable")]
 49        Unusable,
 50        /// <summary>
 51        /// The Batch service has obtained the underlying virtual machine from
 52        /// Azure Compute, but it has not yet started to join the Pool.
 53        /// </summary>
 54        [EnumMember(Value = "creating")]
 55        Creating,
 56        /// <summary>
 57        /// The Batch service is starting on the underlying virtual machine.
 58        /// </summary>
 59        [EnumMember(Value = "starting")]
 60        Starting,
 61        /// <summary>
 62        /// The StartTask has started running on the Compute Node, but
 63        /// waitForSuccess is set and the StartTask has not yet completed.
 64        /// </summary>
 65        [EnumMember(Value = "waitingforstarttask")]
 66        WaitingForStartTask,
 67        /// <summary>
 68        /// The StartTask has failed on the Compute Node (and exhausted all
 69        /// retries), and waitForSuccess is set. The Compute Node is not usable
 70        /// for running Tasks.
 71        /// </summary>
 72        [EnumMember(Value = "starttaskfailed")]
 73        StartTaskFailed,
 74        /// <summary>
 75        /// The Batch service has lost contact with the Compute Node, and does
 76        /// not know its true state.
 77        /// </summary>
 78        [EnumMember(Value = "unknown")]
 79        Unknown,
 80        /// <summary>
 81        /// The Compute Node is leaving the Pool, either because the user
 82        /// explicitly removed it or because the Pool is resizing or
 83        /// autoscaling down.
 84        /// </summary>
 85        [EnumMember(Value = "leavingpool")]
 86        LeavingPool,
 87        /// <summary>
 88        /// The Compute Node is not currently running a Task, and scheduling of
 89        /// new Tasks to the Compute Node is disabled.
 90        /// </summary>
 91        [EnumMember(Value = "offline")]
 92        Offline,
 93        /// <summary>
 94        /// The low-priority Compute Node has been preempted. Tasks which were
 95        /// running on the Compute Node when it was preempted will be
 96        /// rescheduled when another Compute Node becomes available.
 97        /// </summary>
 98        [EnumMember(Value = "preempted")]
 99        Preempted
 100    }
 101    internal static class ComputeNodeStateEnumExtension
 102    {
 103        internal static string ToSerializedValue(this ComputeNodeState? value)
 104        {
 0105            return value == null ? null : ((ComputeNodeState)value).ToSerializedValue();
 106        }
 107
 108        internal static string ToSerializedValue(this ComputeNodeState value)
 109        {
 110            switch( value )
 111            {
 112                case ComputeNodeState.Idle:
 0113                    return "idle";
 114                case ComputeNodeState.Rebooting:
 0115                    return "rebooting";
 116                case ComputeNodeState.Reimaging:
 0117                    return "reimaging";
 118                case ComputeNodeState.Running:
 0119                    return "running";
 120                case ComputeNodeState.Unusable:
 0121                    return "unusable";
 122                case ComputeNodeState.Creating:
 0123                    return "creating";
 124                case ComputeNodeState.Starting:
 0125                    return "starting";
 126                case ComputeNodeState.WaitingForStartTask:
 0127                    return "waitingforstarttask";
 128                case ComputeNodeState.StartTaskFailed:
 0129                    return "starttaskfailed";
 130                case ComputeNodeState.Unknown:
 0131                    return "unknown";
 132                case ComputeNodeState.LeavingPool:
 0133                    return "leavingpool";
 134                case ComputeNodeState.Offline:
 0135                    return "offline";
 136                case ComputeNodeState.Preempted:
 0137                    return "preempted";
 138            }
 0139            return null;
 140        }
 141
 142        internal static ComputeNodeState? ParseComputeNodeState(this string value)
 143        {
 144            switch( value )
 145            {
 146                case "idle":
 0147                    return ComputeNodeState.Idle;
 148                case "rebooting":
 0149                    return ComputeNodeState.Rebooting;
 150                case "reimaging":
 0151                    return ComputeNodeState.Reimaging;
 152                case "running":
 0153                    return ComputeNodeState.Running;
 154                case "unusable":
 0155                    return ComputeNodeState.Unusable;
 156                case "creating":
 0157                    return ComputeNodeState.Creating;
 158                case "starting":
 0159                    return ComputeNodeState.Starting;
 160                case "waitingforstarttask":
 0161                    return ComputeNodeState.WaitingForStartTask;
 162                case "starttaskfailed":
 0163                    return ComputeNodeState.StartTaskFailed;
 164                case "unknown":
 0165                    return ComputeNodeState.Unknown;
 166                case "leavingpool":
 0167                    return ComputeNodeState.LeavingPool;
 168                case "offline":
 0169                    return ComputeNodeState.Offline;
 170                case "preempted":
 0171                    return ComputeNodeState.Preempted;
 172            }
 0173            return null;
 174        }
 175    }
 176}