コード例 #1
0
        /// <summary>
        /// Executes the specified automation document.
        /// </summary>
        /// <param name="documentName">The name of the document to execute.</param>
        /// <param name="parameters">The parameters to pass to the automation document.</param>
        /// <param name="credentials">AWS credentials.</param>
        /// <returns>The automation execution ID of the successfully executed document.</returns>
        /// <exception cref="AutomationExecutionException">The execution of the document failed.</exception>
        public static async Task <string> ExecuteAutomation(
            string documentName, IDictionary <string, ICollection <string> > parameters, Credentials credentials)
        {
            Console.WriteLine($"Starting automation document {documentName}...");

            StartAutomationExecutionResponse response = await GetClient(credentials).StartAutomationExecutionAsync(
                new StartAutomationExecutionRequest
            {
                DocumentName = documentName,
                Parameters   = parameters.ToDictionary(pair => pair.Key, pair => pair.Value.ToList())
            });

            await WaitForAutomation(response.AutomationExecutionId, credentials);

            return(response.AutomationExecutionId);
        }
コード例 #2
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartAutomationExecutionResponse response = new StartAutomationExecutionResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("AutomationExecutionId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.AutomationExecutionId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }