/// <summary>Snippet for DeleteWorkflow</summary> public void DeleteWorkflowResourceNames() { // Snippet: DeleteWorkflow(WorkflowName, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) WorkflowName name = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"); // Make the request Operation <Empty, OperationMetadata> response = workflowsClient.DeleteWorkflow(name); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Empty result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Empty, OperationMetadata> retrievedResponse = workflowsClient.PollOnceDeleteWorkflow(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Empty retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for UpdateWorkflow</summary> public void UpdateWorkflow() { // Snippet: UpdateWorkflow(Workflow, FieldMask, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) Workflow workflow = new Workflow(); FieldMask updateMask = new FieldMask(); // Make the request Operation <Workflow, OperationMetadata> response = workflowsClient.UpdateWorkflow(workflow, updateMask); // Poll until the returned long-running operation is complete Operation <Workflow, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Workflow result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Workflow, OperationMetadata> retrievedResponse = workflowsClient.PollOnceUpdateWorkflow(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Workflow retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for CreateWorkflow</summary> public void CreateWorkflowResourceNames() { // Snippet: CreateWorkflow(LocationName, Workflow, string, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"); Workflow workflow = new Workflow(); string workflowId = ""; // Make the request Operation <Workflow, OperationMetadata> response = workflowsClient.CreateWorkflow(parent, workflow, workflowId); // Poll until the returned long-running operation is complete Operation <Workflow, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Workflow result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Workflow, OperationMetadata> retrievedResponse = workflowsClient.PollOnceCreateWorkflow(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Workflow retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for GetWorkflow</summary> public void GetWorkflowResourceNames() { // Snippet: GetWorkflow(WorkflowName, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) WorkflowName name = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"); // Make the request Workflow response = workflowsClient.GetWorkflow(name); // End snippet }
/// <summary>Snippet for GetWorkflow</summary> public void GetWorkflow() { // Snippet: GetWorkflow(string, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/workflows/[WORKFLOW]"; // Make the request Workflow response = workflowsClient.GetWorkflow(name); // End snippet }
/// <summary>Snippet for GetWorkflow</summary> public void GetWorkflowRequestObject() { // Snippet: GetWorkflow(GetWorkflowRequest, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) GetWorkflowRequest request = new GetWorkflowRequest { WorkflowName = WorkflowName.FromProjectLocationWorkflow("[PROJECT]", "[LOCATION]", "[WORKFLOW]"), }; // Make the request Workflow response = workflowsClient.GetWorkflow(request); // End snippet }
/// <summary>Snippet for ListWorkflows</summary> public void ListWorkflowsRequestObject() { // Snippet: ListWorkflows(ListWorkflowsRequest, CallSettings) // Create client WorkflowsClient workflowsClient = WorkflowsClient.Create(); // Initialize request argument(s) ListWorkflowsRequest request = new ListWorkflowsRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), Filter = "", OrderBy = "", }; // Make the request PagedEnumerable <ListWorkflowsResponse, Workflow> response = workflowsClient.ListWorkflows(request); // Iterate over all response items, lazily performing RPCs as required foreach (Workflow 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 (ListWorkflowsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Workflow 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 <Workflow> 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 (Workflow 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 }