/// <summary>Snippet for CancelExecution</summary>
 public void CancelExecutionResourceNames()
 {
     // Snippet: CancelExecution(ExecutionName, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     ExecutionName name = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
     // Make the request
     Execution response = executionsClient.CancelExecution(name);
     // End snippet
 }
 /// <summary>Snippet for CancelExecution</summary>
 public void CancelExecution()
 {
     // Snippet: CancelExecution(string, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/workflows/[WORKFLOW]/executions/[EXECUTION]";
     // Make the request
     Execution response = executionsClient.CancelExecution(name);
     // End snippet
 }
 /// <summary>Snippet for CreateExecution</summary>
 public void CreateExecutionResourceNames()
 {
     // Snippet: CreateExecution(WorkflowName, Execution, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     WorkflowName parent    = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
     Execution    execution = new Execution();
     // Make the request
     Execution response = executionsClient.CreateExecution(parent, execution);
     // End snippet
 }
 /// <summary>Snippet for CreateExecution</summary>
 public void CreateExecution()
 {
     // Snippet: CreateExecution(string, Execution, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     string    parent    = "projects/[PROJECT]/locations/[LOCATION]/workflows/[WORKFLOW]";
     Execution execution = new Execution();
     // Make the request
     Execution response = executionsClient.CreateExecution(parent, execution);
     // End snippet
 }
        /// <summary>Snippet for CancelExecutionAsync</summary>
        public async Task CancelExecutionResourceNamesAsync()
        {
            // Snippet: CancelExecutionAsync(ExecutionName, CallSettings)
            // Additional: CancelExecutionAsync(ExecutionName, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            ExecutionName name = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]");
            // Make the request
            Execution response = await executionsClient.CancelExecutionAsync(name);

            // End snippet
        }
        /// <summary>Snippet for CancelExecutionAsync</summary>
        public async Task CancelExecutionAsync()
        {
            // Snippet: CancelExecutionAsync(string, CallSettings)
            // Additional: CancelExecutionAsync(string, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/workflows/[WORKFLOW]/executions/[EXECUTION]";
            // Make the request
            Execution response = await executionsClient.CancelExecutionAsync(name);

            // End snippet
        }
 /// <summary>Snippet for CancelExecution</summary>
 public void CancelExecutionRequestObject()
 {
     // Snippet: CancelExecution(CancelExecutionRequest, CallSettings)
     // Create client
     ExecutionsClient executionsClient = ExecutionsClient.Create();
     // Initialize request argument(s)
     CancelExecutionRequest request = new CancelExecutionRequest
     {
         ExecutionName = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]"),
     };
     // Make the request
     Execution response = executionsClient.CancelExecution(request);
     // End snippet
 }
        /// <summary>Snippet for ListExecutionsAsync</summary>
        public async Task ListExecutionsRequestObjectAsync()
        {
            // Snippet: ListExecutionsAsync(ListExecutionsRequest, CallSettings)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            ListExecutionsRequest request = new ListExecutionsRequest
            {
                ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                View = ExecutionView.Unspecified,
            };
            // Make the request
            PagedAsyncEnumerable <ListExecutionsResponse, Execution> response = executionsClient.ListExecutionsAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((Execution item) =>
            {
                // Do something with each item
                Console.WriteLine(item);
            });

            // Or iterate over pages (of server-defined size), performing one RPC per page
            await response.AsRawResponses().ForEachAsync((ListExecutionsResponse page) =>
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Execution item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            });

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Execution> singlePage = await response.ReadPageAsync(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Execution item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
        /// <summary>Snippet for CreateExecutionAsync</summary>
        public async Task CreateExecutionResourceNamesAsync()
        {
            // Snippet: CreateExecutionAsync(WorkflowName, Execution, CallSettings)
            // Additional: CreateExecutionAsync(WorkflowName, Execution, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            WorkflowName parent    = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            Execution    execution = new Execution();
            // Make the request
            Execution response = await executionsClient.CreateExecutionAsync(parent, execution);

            // End snippet
        }
        /// <summary>Snippet for CreateExecutionAsync</summary>
        public async Task CreateExecutionAsync()
        {
            // Snippet: CreateExecutionAsync(string, Execution, CallSettings)
            // Additional: CreateExecutionAsync(string, Execution, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            string    parent    = "projects/[PROJECT]/locations/[LOCATION]/workflows/[WORKFLOW]";
            Execution execution = new Execution();
            // Make the request
            Execution response = await executionsClient.CreateExecutionAsync(parent, execution);

            // End snippet
        }
Exemplo n.º 11
0
        private async Task <Execution> ExecuteWorkflow(string projectId, string region, string workflow, string args)
        {
            var client = await ExecutionsClient.CreateAsync();

            var request = new CreateExecutionRequest()
            {
                Parent    = WorkflowName.Format(projectId, region, workflow),
                Execution = new Execution()
                {
                    Argument = args
                }
            };

            var response = await client.CreateExecutionAsync(request);

            return(response);
        }
        /// <summary>Snippet for GetExecutionAsync</summary>
        public async Task GetExecutionRequestObjectAsync()
        {
            // Snippet: GetExecutionAsync(GetExecutionRequest, CallSettings)
            // Additional: GetExecutionAsync(GetExecutionRequest, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            GetExecutionRequest request = new GetExecutionRequest
            {
                ExecutionName = ExecutionName.FromProjectLocationWorkflowExecution("[PROJECT]", "[LOCATION]", "[WORKFLOW]", "[EXECUTION]"),
                View          = ExecutionView.Unspecified,
            };
            // Make the request
            Execution response = await executionsClient.GetExecutionAsync(request);

            // End snippet
        }
        /// <summary>Snippet for CreateExecutionAsync</summary>
        public async Task CreateExecutionRequestObjectAsync()
        {
            // Snippet: CreateExecutionAsync(CreateExecutionRequest, CallSettings)
            // Additional: CreateExecutionAsync(CreateExecutionRequest, CancellationToken)
            // Create client
            ExecutionsClient executionsClient = await ExecutionsClient.CreateAsync();

            // Initialize request argument(s)
            CreateExecutionRequest request = new CreateExecutionRequest
            {
                ParentAsWorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"),
                Execution            = new Execution(),
            };
            // Make the request
            Execution response = await executionsClient.CreateExecutionAsync(request);

            // End snippet
        }
        /// <summary>Snippet for ListExecutions</summary>
        public void ListExecutionsResourceNames()
        {
            // Snippet: ListExecutions(WorkflowName, string, int?, CallSettings)
            // Create client
            ExecutionsClient executionsClient = ExecutionsClient.Create();
            // Initialize request argument(s)
            WorkflowName parent = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]");
            // Make the request
            PagedEnumerable <ListExecutionsResponse, Execution> response = executionsClient.ListExecutions(parent);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Execution item in response)
            {
                // Do something with each item
                Console.WriteLine(item);
            }

            // Or iterate over pages (of server-defined size), performing one RPC per page
            foreach (ListExecutionsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Execution item in page)
                {
                    // Do something with each item
                    Console.WriteLine(item);
                }
            }

            // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
            int pageSize = 10;
            Page <Execution> singlePage = response.ReadPage(pageSize);

            // Do something with the page of items
            Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
            foreach (Execution item in singlePage)
            {
                // Do something with each item
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }