Ejemplo n.º 1
0
        /// <summary>
        /// The GetConsoleOutput operation retrieves console output for the specified
        /// instance.
        /// Instance console output is buffered and posted shortly after instance boot,
        /// reboot, and termination. Amazon EC2 preserves the most recent 64 KB output
        /// which will be available for at least one hour after the most recent post.
        /// 
        /// </summary>
        /// <param name="service">Instance of AmazonEC2 service</param>
        /// <param name="request">GetConsoleOutputRequest request</param>
        public static void InvokeGetConsoleOutput(AmazonEC2 service, GetConsoleOutputRequest request)
        {
            try 
            {
                GetConsoleOutputResponse response = service.GetConsoleOutput(request);
                
                
                Console.WriteLine ("Service Response");
                Console.WriteLine ("=============================================================================");
                Console.WriteLine ();

                Console.WriteLine("        GetConsoleOutputResponse");
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata  responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
                if (response.IsSetGetConsoleOutputResult())
                {
                    Console.WriteLine("            GetConsoleOutputResult");
                    GetConsoleOutputResult  getConsoleOutputResult = response.GetConsoleOutputResult;
                    if (getConsoleOutputResult.IsSetConsoleOutput())
                    {
                        Console.WriteLine("                ConsoleOutput");
                        ConsoleOutput  consoleOutput = getConsoleOutputResult.ConsoleOutput;
                        if (consoleOutput.IsSetInstanceId())
                        {
                            Console.WriteLine("                    InstanceId");
                            Console.WriteLine("                        {0}", consoleOutput.InstanceId);
                        }
                        if (consoleOutput.IsSetTimestamp())
                        {
                            Console.WriteLine("                    Timestamp");
                            Console.WriteLine("                        {0}", consoleOutput.Timestamp);
                        }
                        if (consoleOutput.IsSetOutput())
                        {
                            Console.WriteLine("                    Output");
                            Console.WriteLine("                        {0}", consoleOutput.Output);
                        }
                    }
                }

            } 
            catch (AmazonEC2Exception ex) 
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
            }
        }
 protected override void ProcessRecord()
 {
     AmazonEC2 client = base.GetClient();
     Amazon.EC2.Model.GetConsoleOutputRequest request = new Amazon.EC2.Model.GetConsoleOutputRequest();
     request.InstanceId = this._InstanceId;
     Amazon.EC2.Model.GetConsoleOutputResponse response = client.GetConsoleOutput(request);
     base.WriteObject(response.GetConsoleOutputResult.ConsoleOutput, true);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the GetConsoleOutput operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetConsoleOutput operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<GetConsoleOutputResponse> GetConsoleOutputAsync(GetConsoleOutputRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetConsoleOutputRequestMarshaller();
            var unmarshaller = GetConsoleOutputResponseUnmarshaller.Instance;

            return InvokeAsync<GetConsoleOutputRequest,GetConsoleOutputResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Gets the console output for the specified instance.
        /// 
        ///  
        /// <para>
        /// Instances do not have a physical monitor through which you can view their console
        /// output. They also lack physical controls that allow you to power up, reboot, or shut
        /// them down. To allow these actions, we provide them through the Amazon EC2 API and
        /// command line interface.
        /// </para>
        ///  
        /// <para>
        /// Instance console output is buffered and posted shortly after instance boot, reboot,
        /// and termination. Amazon EC2 preserves the most recent 64 KB output which is available
        /// for at least one hour after the most recent post.
        /// </para>
        ///  
        /// <para>
        /// For Linux instances, the instance console output displays the exact console output
        /// that would normally be displayed on a physical monitor attached to a computer. This
        /// output is buffered because the instance produces it and then posts it to a store where
        /// the instance's owner can retrieve it.
        /// </para>
        ///  
        /// <para>
        /// For Windows instances, the instance console output includes output from the EC2Config
        /// service.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the GetConsoleOutput service method.</param>
        /// 
        /// <returns>The response from the GetConsoleOutput service method, as returned by EC2.</returns>
        public GetConsoleOutputResponse GetConsoleOutput(GetConsoleOutputRequest request)
        {
            var marshaller = new GetConsoleOutputRequestMarshaller();
            var unmarshaller = GetConsoleOutputResponseUnmarshaller.Instance;

            return Invoke<GetConsoleOutputRequest,GetConsoleOutputResponse>(request, marshaller, unmarshaller);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetConsoleOutput operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetConsoleOutput operation on AmazonEC2Client.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetConsoleOutput
        ///         operation.</returns>
        public IAsyncResult BeginGetConsoleOutput(GetConsoleOutputRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new GetConsoleOutputRequestMarshaller();
            var unmarshaller = GetConsoleOutputResponseUnmarshaller.Instance;

            return BeginInvoke<GetConsoleOutputRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Ejemplo n.º 6
0
 IAsyncResult invokeGetConsoleOutput(GetConsoleOutputRequest getConsoleOutputRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new GetConsoleOutputRequestMarshaller().Marshall(getConsoleOutputRequest);
     var unmarshaller = GetConsoleOutputResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Initiates the asynchronous execution of the GetConsoleOutput operation.
 /// <seealso cref="Amazon.EC2.IAmazonEC2.GetConsoleOutput"/>
 /// </summary>
 /// 
 /// <param name="getConsoleOutputRequest">Container for the necessary parameters to execute the GetConsoleOutput operation on AmazonEC2.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// 
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndGetConsoleOutput
 ///         operation.</returns>
 public IAsyncResult BeginGetConsoleOutput(GetConsoleOutputRequest getConsoleOutputRequest, AsyncCallback callback, object state)
 {
     return invokeGetConsoleOutput(getConsoleOutputRequest, callback, state, false);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// <para>Gets the console output for the specified instance.</para> <para>Instances do not have a physical monitor through which you can view
 /// their console output. They also lack physical controls that allow you to power up, reboot, or shut them down. To allow these actions, we
 /// provide them through the Amazon EC2 API and command line interface.</para> <para>Instance console output is buffered and posted shortly
 /// after instance boot, reboot, and termination. Amazon EC2 preserves the most recent 64 KB output which is available for at least one hour
 /// after the most recent post.</para> <para>For Linux/Unix instances, the instance console output displays the exact console output that would
 /// normally be displayed on a physical monitor attached to a machine. This output is buffered because the instance produces it and then posts
 /// it to a store where the instance's owner can retrieve it.</para> <para>For Windows instances, the instance console output displays the last
 /// three system event log errors.</para>
 /// </summary>
 /// 
 /// <param name="getConsoleOutputRequest">Container for the necessary parameters to execute the GetConsoleOutput service method on
 ///          AmazonEC2.</param>
 /// 
 /// <returns>The response from the GetConsoleOutput service method, as returned by AmazonEC2.</returns>
 /// 
 public GetConsoleOutputResponse GetConsoleOutput(GetConsoleOutputRequest getConsoleOutputRequest)
 {
     IAsyncResult asyncResult = invokeGetConsoleOutput(getConsoleOutputRequest, null, null, true);
     return EndGetConsoleOutput(asyncResult);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// <para>Gets the console output for the specified instance.</para> <para>Instances do not have a physical monitor through which you can view
        /// their console output. They also lack physical controls that allow you to power up, reboot, or shut them down. To allow these actions, we
        /// provide them through the Amazon EC2 API and command line interface.</para> <para>Instance console output is buffered and posted shortly
        /// after instance boot, reboot, and termination. Amazon EC2 preserves the most recent 64 KB output which is available for at least one hour
        /// after the most recent post.</para> <para>For Linux/Unix instances, the instance console output displays the exact console output that would
        /// normally be displayed on a physical monitor attached to a machine. This output is buffered because the instance produces it and then posts
        /// it to a store where the instance's owner can retrieve it.</para> <para>For Windows instances, the instance console output displays the last
        /// three system event log errors.</para>
        /// </summary>
        /// 
        /// <param name="getConsoleOutputRequest">Container for the necessary parameters to execute the GetConsoleOutput service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the GetConsoleOutput service method, as returned by AmazonEC2.</returns>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<GetConsoleOutputResponse> GetConsoleOutputAsync(GetConsoleOutputRequest getConsoleOutputRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetConsoleOutputRequestMarshaller();
            var unmarshaller = GetConsoleOutputResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, GetConsoleOutputRequest, GetConsoleOutputResponse>(getConsoleOutputRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Ejemplo n.º 10
0
		internal GetConsoleOutputResponse GetConsoleOutput(GetConsoleOutputRequest request)
        {
            var task = GetConsoleOutputAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Initiates the asynchronous execution of the GetConsoleOutput operation.
        /// <seealso cref="Amazon.EC2.IAmazonEC2.GetConsoleOutput"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetConsoleOutput operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<GetConsoleOutputResponse> GetConsoleOutputAsync(GetConsoleOutputRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new GetConsoleOutputRequestMarshaller();
            var unmarshaller = GetConsoleOutputResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, GetConsoleOutputRequest, GetConsoleOutputResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// <para> The GetConsoleOutput operation retrieves console output for the specified instance. </para> <para> Instance console output is
        /// buffered and posted shortly after instance boot, reboot, and termination. Amazon EC2 preserves the most recent 64 KB output which will be
        /// available for at least one hour after the most recent post. </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the GetConsoleOutput service method on
        /// AmazonEC2.</param>
        /// 
        /// <returns>The response from the GetConsoleOutput service method, as returned by AmazonEC2.</returns>
		public GetConsoleOutputResponse GetConsoleOutput(GetConsoleOutputRequest request)
        {
            var task = GetConsoleOutputAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Ejemplo n.º 13
0
 public ConsoleOutput GetConsoleOutput(string instanceId)
 {
     try
     {
         AWSModel.GetConsoleOutputRequest request = new AWSModel.GetConsoleOutputRequest();
         request.InstanceId = instanceId;
         AWSModel.GetConsoleOutputResponse response = ec2.GetConsoleOutput(request);
         if (response != null)
             return ModelUtil.CreateInstance(response.GetConsoleOutputResult.ConsoleOutput);
         else
             return null;
     }
     catch (WebException e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
     catch (AmazonEC2Exception e)
     {
         throw new MonoscapeEC2Exception(e.Message, e);
     }
 }