Exemple #1
0
        /// <summary>Snippet for ImportFlowAsync</summary>
        public async Task ImportFlowRequestObjectAsync()
        {
            // Snippet: ImportFlowAsync(ImportFlowRequest, CallSettings)
            // Additional: ImportFlowAsync(ImportFlowRequest, CancellationToken)
            // Create client
            FlowsClient flowsClient = await FlowsClient.CreateAsync();

            // 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 = await flowsClient.ImportFlowAsync(request);

            // Poll until the returned long-running operation is complete
            Operation <ImportFlowResponse, Struct> completedResponse = await response.PollUntilCompletedAsync();

            // 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 = await flowsClient.PollOnceImportFlowAsync(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
        }