/// <summary>Snippet for RestoreAgent</summary> public void RestoreAgent_RequestObject() { // Snippet: RestoreAgent(RestoreAgentRequest,CallSettings) // Create client AgentsClient agentsClient = AgentsClient.Create(); // Initialize request argument(s) RestoreAgentRequest request = new RestoreAgentRequest { ParentAsProjectName = new ProjectName("[PROJECT]"), }; // Make the request Operation <Empty, Struct> response = agentsClient.RestoreAgent(request); // Poll until the returned long-running operation is complete Operation <Empty, Struct> completedResponse = response.PollUntilCompleted(); // The long-running operation is now complete. // 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 = agentsClient.PollOnceRestoreAgent(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // The long-running operation is now complete. } // End snippet }
/// <summary>Snippet for RestoreAgent</summary> public void RestoreAgentRequestObject() { // Snippet: RestoreAgent(RestoreAgentRequest, CallSettings) // Create client AgentsClient agentsClient = AgentsClient.Create(); // Initialize request argument(s) RestoreAgentRequest request = new RestoreAgentRequest { AgentName = AgentName.FromProjectLocationAgent("[PROJECT]", "[LOCATION]", "[AGENT]"), AgentUri = "", AgentContent = ByteString.Empty, }; // Make the request Operation <Empty, Struct> response = agentsClient.RestoreAgent(request); // 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 = agentsClient.PollOnceRestoreAgent(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 RestoreAgentAsync</summary> public async Task RestoreAgentRequestObjectAsync() { // Snippet: RestoreAgentAsync(RestoreAgentRequest, CallSettings) // Additional: RestoreAgentAsync(RestoreAgentRequest, CancellationToken) // Create client AgentsClient agentsClient = await AgentsClient.CreateAsync(); // Initialize request argument(s) RestoreAgentRequest request = new RestoreAgentRequest { ParentAsProjectName = ProjectName.FromProject("[PROJECT]"), AgentUri = "", }; // Make the request Operation <Empty, Struct> response = await agentsClient.RestoreAgentAsync(request); // Poll until the returned long-running operation is complete Operation <Empty, Struct> completedResponse = await response.PollUntilCompletedAsync(); // 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 = await agentsClient.PollOnceRestoreAgentAsync(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 }