Example #1
0
 /// <summary>
 /// Update API key asynchronously.
 /// </summary>
 /// <example>
 /// This example shows how to use the <see cref="AccountManagementApi.UpdateApiKeyAsync(string, ApiKey)"/> method.
 /// <code>
 /// try
 /// {
 ///     var key = await accountApi.GetApiKeyAsync()
 ///     key.Name = "updated api key";
 ///     var updatedApiKey = await accountApi.UpdateApiKeyAsync(key.Id, key);
 ///     return updatedApiKey;
 /// }
 /// catch (CloudApiException)
 /// {
 ///     throw;
 /// }
 /// </code>
 /// </example>
 /// <param name="apiKeyId">Id</param>
 /// <param name="key"><see cref="ApiKey"/></param>
 /// <returns><see cref="Task"/> with <see cref="ApiKey"/></returns>
 /// <exception cref="CloudApiException">CloudApiException</exception>
 public async Task <ApiKey> UpdateApiKeyAsync(string apiKeyId, ApiKey key)
 {
     try
     {
         var req = key.CreatePutRequest();
         return(ApiKey.Map(await DeveloperApi.UpdateApiKeyAsync(apiKeyId, req)));
     }
     catch (iam.Client.ApiException e)
     {
         throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent);
     }
 }