예제 #1
0
 internal ManagedInstanceOperation(string id, string name, string type, string managedInstanceName, string operation, string operationFriendlyName, int?percentComplete, DateTimeOffset?startTime, ManagementOperationState?state, int?errorCode, string errorDescription, int?errorSeverity, bool?isUserError, DateTimeOffset?estimatedCompletionTime, string description, bool?isCancellable, ManagedInstanceOperationParametersPair operationParameters, ManagedInstanceOperationSteps operationSteps) : base(id, name, type)
 {
     ManagedInstanceName   = managedInstanceName;
     Operation             = operation;
     OperationFriendlyName = operationFriendlyName;
     PercentComplete       = percentComplete;
     StartTime             = startTime;
     State                   = state;
     ErrorCode               = errorCode;
     ErrorDescription        = errorDescription;
     ErrorSeverity           = errorSeverity;
     IsUserError             = isUserError;
     EstimatedCompletionTime = estimatedCompletionTime;
     Description             = description;
     IsCancellable           = isCancellable;
     OperationParameters     = operationParameters;
     OperationSteps          = operationSteps;
 }
예제 #2
0
        internal static ManagedInstanceOperation DeserializeManagedInstanceOperation(JsonElement element)
        {
            Optional <string>                   id   = default;
            Optional <string>                   name = default;
            Optional <string>                   type = default;
            Optional <string>                   managedInstanceName   = default;
            Optional <string>                   operation             = default;
            Optional <string>                   operationFriendlyName = default;
            Optional <int>                      percentComplete       = default;
            Optional <DateTimeOffset>           startTime             = default;
            Optional <ManagementOperationState> state                             = default;
            Optional <int>                      errorCode                         = default;
            Optional <string>                   errorDescription                  = default;
            Optional <int>                      errorSeverity                     = default;
            Optional <bool>                     isUserError                       = default;
            Optional <DateTimeOffset>           estimatedCompletionTime           = default;
            Optional <string>                   description                       = default;
            Optional <bool>                     isCancellable                     = default;
            Optional <ManagedInstanceOperationParametersPair> operationParameters = default;
            Optional <ManagedInstanceOperationSteps>          operationSteps      = 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("properties"))
                {
                    foreach (var property0 in property.Value.EnumerateObject())
                    {
                        if (property0.NameEquals("managedInstanceName"))
                        {
                            managedInstanceName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("operation"))
                        {
                            operation = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("operationFriendlyName"))
                        {
                            operationFriendlyName = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("percentComplete"))
                        {
                            percentComplete = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("startTime"))
                        {
                            startTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("state"))
                        {
                            state = new ManagementOperationState(property0.Value.GetString());
                            continue;
                        }
                        if (property0.NameEquals("errorCode"))
                        {
                            errorCode = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("errorDescription"))
                        {
                            errorDescription = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("errorSeverity"))
                        {
                            errorSeverity = property0.Value.GetInt32();
                            continue;
                        }
                        if (property0.NameEquals("isUserError"))
                        {
                            isUserError = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("estimatedCompletionTime"))
                        {
                            estimatedCompletionTime = property0.Value.GetDateTimeOffset("O");
                            continue;
                        }
                        if (property0.NameEquals("description"))
                        {
                            description = property0.Value.GetString();
                            continue;
                        }
                        if (property0.NameEquals("isCancellable"))
                        {
                            isCancellable = property0.Value.GetBoolean();
                            continue;
                        }
                        if (property0.NameEquals("operationParameters"))
                        {
                            operationParameters = ManagedInstanceOperationParametersPair.DeserializeManagedInstanceOperationParametersPair(property0.Value);
                            continue;
                        }
                        if (property0.NameEquals("operationSteps"))
                        {
                            operationSteps = ManagedInstanceOperationSteps.DeserializeManagedInstanceOperationSteps(property0.Value);
                            continue;
                        }
                    }
                    continue;
                }
            }
            return(new ManagedInstanceOperation(id.Value, name.Value, type.Value, managedInstanceName.Value, operation.Value, operationFriendlyName.Value, Optional.ToNullable(percentComplete), Optional.ToNullable(startTime), Optional.ToNullable(state), Optional.ToNullable(errorCode), errorDescription.Value, Optional.ToNullable(errorSeverity), Optional.ToNullable(isUserError), Optional.ToNullable(estimatedCompletionTime), description.Value, Optional.ToNullable(isCancellable), operationParameters.Value, operationSteps.Value));
        }