/// <summary>Snippet for AddPublicKeyAsync</summary> public async Task AddPublicKeyRequestObjectAsync() { // Snippet: AddPublicKeyAsync(AddPublicKeyRequest, CallSettings) // Additional: AddPublicKeyAsync(AddPublicKeyRequest, CancellationToken) // Create client CloudShellServiceClient cloudShellServiceClient = await CloudShellServiceClient.CreateAsync(); // Initialize request argument(s) AddPublicKeyRequest request = new AddPublicKeyRequest { Environment = "", Key = "", }; // Make the request Operation <AddPublicKeyResponse, AddPublicKeyMetadata> response = await cloudShellServiceClient.AddPublicKeyAsync(request); // Poll until the returned long-running operation is complete Operation <AddPublicKeyResponse, AddPublicKeyMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result AddPublicKeyResponse 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 <AddPublicKeyResponse, AddPublicKeyMetadata> retrievedResponse = await cloudShellServiceClient.PollOnceAddPublicKeyAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result AddPublicKeyResponse retrievedResult = retrievedResponse.Result; } // End snippet }