/// <summary>Snippet for CreateVersionAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateVersionRequestObjectAsync() { // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) CreateVersionRequest request = new CreateVersionRequest { Parent = "", Version = new Version(), }; // Make the request Operation <Version, CreateVersionMetadataV1> response = await versionsClient.CreateVersionAsync(request); // Poll until the returned long-running operation is complete Operation <Version, CreateVersionMetadataV1> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Version 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 <Version, CreateVersionMetadataV1> retrievedResponse = await versionsClient.PollOnceCreateVersionAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Version retrievedResult = retrievedResponse.Result; } }
/// <summary>Snippet for CreateVersionAsync</summary> public async Task CreateVersionResourceNamesAsync() { // Snippet: CreateVersionAsync(FlowName, Version, CallSettings) // Additional: CreateVersionAsync(FlowName, Version, CancellationToken) // Create client VersionsClient versionsClient = await VersionsClient.CreateAsync(); // Initialize request argument(s) FlowName parent = FlowName.FromProjectLocationAgentFlow("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]"); gcdcv::Version version = new gcdcv::Version(); // Make the request Operation <gcdcv::Version, CreateVersionOperationMetadata> response = await versionsClient.CreateVersionAsync(parent, version); // Poll until the returned long-running operation is complete Operation <gcdcv::Version, CreateVersionOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result gcdcv::Version 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 <gcdcv::Version, CreateVersionOperationMetadata> retrievedResponse = await versionsClient.PollOnceCreateVersionAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result gcdcv::Version retrievedResult = retrievedResponse.Result; } // End snippet }