/// <summary>Snippet for ExportAgent</summary> public void ExportAgent_RequestObject() { // Snippet: ExportAgent(ExportAgentRequest,CallSettings) // Create client AgentsClient agentsClient = AgentsClient.Create(); // Initialize request argument(s) ExportAgentRequest request = new ExportAgentRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), }; // Make the request Operation <ExportAgentResponse, Struct> response = agentsClient.ExportAgent(request); // Poll until the returned long-running operation is complete Operation <ExportAgentResponse, Struct> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result ExportAgentResponse 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 <ExportAgentResponse, Struct> retrievedResponse = agentsClient.PollOnceExportAgent(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ExportAgentResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ExportAgentAsync</summary> public async Task ExportAgentRequestObjectAsync() { // Snippet: ExportAgentAsync(ExportAgentRequest, CallSettings) // Additional: ExportAgentAsync(ExportAgentRequest, CancellationToken) // Create client AgentsClient agentsClient = await AgentsClient.CreateAsync(); // Initialize request argument(s) ExportAgentRequest request = new ExportAgentRequest { AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"), AgentUri = "", }; // Make the request Operation <ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(request); // Poll until the returned long-running operation is complete Operation <ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result ExportAgentResponse 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 <ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ExportAgentResponse retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary>Snippet for ExportAgentAsync</summary> public async Task ExportAgentAsync() { // Snippet: ExportAgentAsync(string, CallSettings) // Additional: ExportAgentAsync(string, CancellationToken) // Create client AgentsClient agentsClient = await AgentsClient.CreateAsync(); // Initialize request argument(s) string parent = "projects/[PROJECT]"; // Make the request Operation <ExportAgentResponse, Struct> response = await agentsClient.ExportAgentAsync(parent); // Poll until the returned long-running operation is complete Operation <ExportAgentResponse, Struct> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result ExportAgentResponse 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 <ExportAgentResponse, Struct> retrievedResponse = await agentsClient.PollOnceExportAgentAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result ExportAgentResponse retrievedResult = retrievedResponse.Result; } // End snippet }