예제 #1
0
        public void SetUp()
        {
            var scriptName               = "MyTestScript";
            var scriptState              = "success";
            var scriptReason             = "ScriptReason";
            var scriptOutputObjectFormat = ScriptExecutionResponse.OutputObjectsFormatEnum.Json;
            var scriptStreams            = new VMware.ScriptRuntimeService.RunspaceClient.Bindings.Model.ScriptExecutionStreams(
                new List <StreamRecord>(new [] { new StreamRecord {
                                                     Time    = DateTime.Today,
                                                     Message = "InfoStream"
                                                 } }),
                new List <StreamRecord>(new[] { new StreamRecord {
                                                    Time    = DateTime.Today,
                                                    Message = "ErrorStream"
                                                } }),
                new List <StreamRecord>(new[] { new StreamRecord {
                                                    Time    = DateTime.Today,
                                                    Message = "WarningStream"
                                                } }),
                new List <StreamRecord>(new[] { new StreamRecord {
                                                    Time    = DateTime.Today,
                                                    Message = "DebugStream"
                                                } }),
                new List <StreamRecord>(new[] { new StreamRecord {
                                                    Time    = DateTime.Today,
                                                    Message = "VerboseStream"
                                                } }));

            var scriptJsonOutput =
                new VMware.ScriptRuntimeService.RunspaceClient.Bindings.Model.OutputObjectCollection(serializedObjects: new List <string>(new[] { "{'name':'JsonResult'}" }));


            var scriptResult = new ScriptResult(
                new ScriptExecutionResponse(
                    _scriptId,
                    scriptState,
                    scriptReason,
                    scriptJsonOutput,
                    scriptStreams,
                    scriptOutputObjectFormat));

            _scriptExecution = new NamedScriptExecution(
                scriptName,
                scriptResult);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptExecutionResponse" /> class.
 /// </summary>
 /// <param name="id">id.</param>
 /// <param name="state">state.</param>
 /// <param name="reason">reason.</param>
 /// <param name="outputObjectCollection">outputObjectCollection.</param>
 /// <param name="dataStreams">dataStreams.</param>
 /// <param name="outputObjectsFormat">outputObjectsFormat (required).</param>
 /// <param name="startTime">startTime.</param>
 /// <param name="endTime">endTime.</param>
 public ScriptExecutionResponse(string id = default(string), string state = default(string), string reason = default(string), OutputObjectCollection outputObjectCollection = default(OutputObjectCollection), ScriptExecutionStreams dataStreams = default(ScriptExecutionStreams), OutputObjectsFormatEnum outputObjectsFormat = default(OutputObjectsFormatEnum), DateTime?startTime = default(DateTime?), DateTime?endTime = default(DateTime?), string name = default(string))
 {
     // to ensure "outputObjectsFormat" is required (not null)
     if (outputObjectsFormat == null)
     {
         throw new InvalidDataException("outputObjectsFormat is a required property for ScriptExecutionResponse and cannot be null");
     }
     else
     {
         this.OutputObjectsFormat = outputObjectsFormat;
     }
     this.Id     = id;
     this.Name   = name;
     this.State  = state;
     this.Reason = reason;
     this.OutputObjectCollection = outputObjectCollection;
     this.DataStreams            = dataStreams;
     this.StartTime = startTime;
     this.EndTime   = endTime;
 }