Пример #1
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
        }