/// <summary>Snippet for CreateApi</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateApi() { // Create client ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]"; Api api = new Api(); string apiId = ""; // Make the request Operation <Api, OperationMetadata> response = apiGatewayServiceClient.CreateApi(parent, api, apiId); // Poll until the returned long-running operation is complete Operation <Api, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Api 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 <Api, OperationMetadata> retrievedResponse = apiGatewayServiceClient.PollOnceCreateApi(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Api retrievedResult = retrievedResponse.Result; } }
/// <summary>Snippet for CreateApi</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateApiRequestObject() { // Create client ApiGatewayServiceClient apiGatewayServiceClient = ApiGatewayServiceClient.Create(); // Initialize request argument(s) CreateApiRequest request = new CreateApiRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), ApiId = "", Api = new Api(), }; // Make the request Operation <Api, OperationMetadata> response = apiGatewayServiceClient.CreateApi(request); // Poll until the returned long-running operation is complete Operation <Api, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Api 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 <Api, OperationMetadata> retrievedResponse = apiGatewayServiceClient.PollOnceCreateApi(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Api retrievedResult = retrievedResponse.Result; } }