Ejemplo n.º 1
0
        /// <summary>Snippet for ExportFlow</summary>
        public void ExportFlowRequestObject()
        {
            // Snippet: ExportFlow(ExportFlowRequest, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            ExportFlowRequest request = new ExportFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                FlowUri  = "",
                IncludeReferencedFlows = false,
            };
            // Make the request
            Operation <ExportFlowResponse, Struct> response = flowsClient.ExportFlow(request);

            // Poll until the returned long-running operation is complete
            Operation <ExportFlowResponse, Struct> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            ExportFlowResponse 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 <ExportFlowResponse, Struct> retrievedResponse = flowsClient.PollOnceExportFlow(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ExportFlowResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Ejemplo n.º 2
0
        /// <summary>Snippet for TrainFlow</summary>
        public void TrainFlowResourceNames()
        {
            // Snippet: TrainFlow(FlowName, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            FlowName name = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
            // Make the request
            Operation <Empty, Struct> response = flowsClient.TrainFlow(name);

            // Poll until the returned long-running operation is complete
            Operation <Empty, Struct> 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, Struct> retrievedResponse = flowsClient.PollOnceTrainFlow(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
        }
Ejemplo n.º 3
0
        /// <summary>Snippet for ImportFlow</summary>
        public void ImportFlowRequestObject()
        {
            // Snippet: ImportFlow(ImportFlowRequest, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            ImportFlowRequest request = new ImportFlowRequest
            {
                ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                FlowUri           = "",
                ImportOption      = ImportFlowRequest.Types.ImportOption.Unspecified,
            };
            // Make the request
            Operation <ImportFlowResponse, Struct> response = flowsClient.ImportFlow(request);

            // Poll until the returned long-running operation is complete
            Operation <ImportFlowResponse, Struct> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            ImportFlowResponse 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 <ImportFlowResponse, Struct> retrievedResponse = flowsClient.PollOnceImportFlow(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                ImportFlowResponse retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }
Ejemplo n.º 4
0
 /// <summary>Snippet for GetFlowValidationResult</summary>
 public void GetFlowValidationResultResourceNames()
 {
     // Snippet: GetFlowValidationResult(FlowValidationResultName, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     FlowValidationResultName name = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
     // Make the request
     FlowValidationResult response = flowsClient.GetFlowValidationResult(name);
     // End snippet
 }
Ejemplo n.º 5
0
 /// <summary>Snippet for GetFlowValidationResult</summary>
 public void GetFlowValidationResult()
 {
     // Snippet: GetFlowValidationResult(string, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/flows/[FLOW]/validationResult";
     // Make the request
     FlowValidationResult response = flowsClient.GetFlowValidationResult(name);
     // End snippet
 }
Ejemplo n.º 6
0
 /// <summary>Snippet for CreateFlow</summary>
 public void CreateFlowResourceNames()
 {
     // Snippet: CreateFlow(AgentName, Flow, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     AgentName parent = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]");
     Flow      flow   = new Flow();
     // Make the request
     Flow response = flowsClient.CreateFlow(parent, flow);
     // End snippet
 }
Ejemplo n.º 7
0
 /// <summary>Snippet for CreateFlow</summary>
 public void CreateFlow()
 {
     // Snippet: CreateFlow(string, Flow, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     string parent = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]";
     Flow   flow   = new Flow();
     // Make the request
     Flow response = flowsClient.CreateFlow(parent, flow);
     // End snippet
 }
Ejemplo n.º 8
0
 /// <summary>Snippet for UpdateFlow</summary>
 public void UpdateFlow()
 {
     // Snippet: UpdateFlow(Flow, FieldMask, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     Flow      flow       = new Flow();
     FieldMask updateMask = new FieldMask();
     // Make the request
     Flow response = flowsClient.UpdateFlow(flow, updateMask);
     // End snippet
 }
Ejemplo n.º 9
0
        /// <summary>Snippet for DeleteFlow</summary>
        public void DeleteFlowResourceNames()
        {
            // Snippet: DeleteFlow(FlowName, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            FlowName name = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");

            // Make the request
            flowsClient.DeleteFlow(name);
            // End snippet
        }
Ejemplo n.º 10
0
        /// <summary>Snippet for DeleteFlow</summary>
        public void DeleteFlow()
        {
            // Snippet: DeleteFlow(string, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/agents/[AGENT]/flows/[FLOW]";

            // Make the request
            flowsClient.DeleteFlow(name);
            // End snippet
        }
Ejemplo n.º 11
0
 /// <summary>Snippet for GetFlowValidationResult</summary>
 public void GetFlowValidationResultRequestObject()
 {
     // Snippet: GetFlowValidationResult(GetFlowValidationResultRequest, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     GetFlowValidationResultRequest request = new GetFlowValidationResultRequest
     {
         FlowValidationResultName = FlowValidationResultName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
         LanguageCode             = "",
     };
     // Make the request
     FlowValidationResult response = flowsClient.GetFlowValidationResult(request);
     // End snippet
 }
Ejemplo n.º 12
0
        /// <summary>Snippet for ListFlows</summary>
        public void ListFlowsRequestObject()
        {
            // Snippet: ListFlows(ListFlowsRequest, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            ListFlowsRequest request = new ListFlowsRequest
            {
                ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
                LanguageCode      = "",
            };
            // Make the request
            PagedEnumerable <ListFlowsResponse, Flow> response = flowsClient.ListFlows(request);

            // Iterate over all response items, lazily performing RPCs as required
            foreach (Flow 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 (ListFlowsResponse page in response.AsRawResponses())
            {
                // Do something with each page of items
                Console.WriteLine("A page of results:");
                foreach (Flow 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 <Flow> 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 (Flow 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
        }
Ejemplo n.º 13
0
 /// <summary>Snippet for UpdateFlow</summary>
 public void UpdateFlowRequestObject()
 {
     // Snippet: UpdateFlow(UpdateFlowRequest, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     UpdateFlowRequest request = new UpdateFlowRequest
     {
         Flow         = new Flow(),
         UpdateMask   = new FieldMask(),
         LanguageCode = "",
     };
     // Make the request
     Flow response = flowsClient.UpdateFlow(request);
     // End snippet
 }
Ejemplo n.º 14
0
 /// <summary>Snippet for CreateFlow</summary>
 public void CreateFlowRequestObject()
 {
     // Snippet: CreateFlow(CreateFlowRequest, CallSettings)
     // Create client
     FlowsClient flowsClient = FlowsClient.Create();
     // Initialize request argument(s)
     CreateFlowRequest request = new CreateFlowRequest
     {
         ParentAsAgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"),
         Flow         = new Flow(),
         LanguageCode = "",
     };
     // Make the request
     Flow response = flowsClient.CreateFlow(request);
     // End snippet
 }
Ejemplo n.º 15
0
        /// <summary>Snippet for DeleteFlow</summary>
        public void DeleteFlowRequestObject()
        {
            // Snippet: DeleteFlow(DeleteFlowRequest, CallSettings)
            // Create client
            FlowsClient flowsClient = FlowsClient.Create();
            // Initialize request argument(s)
            DeleteFlowRequest request = new DeleteFlowRequest
            {
                FlowName = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"),
                Force    = false,
            };

            // Make the request
            flowsClient.DeleteFlow(request);
            // End snippet
        }