コード例 #1
0
 /// <summary>
 /// Get a firmware image with provided image_id.
 /// </summary>
 /// <param name="imageId">Id</param>
 /// <returns><see cref="FirmwareImage"/></returns>
 /// <exception cref="CloudApiException">CloudApiException</exception>
 /// <example>
 /// <code>
 /// try
 /// {
 ///     var image = updateApI.GetFirmwareImage("015baf5f4f04000000000001001003d5");
 ///     return image;
 /// }
 /// catch (CloudApiException)
 /// {
 ///     throw;
 /// }
 /// </code>
 /// </example>
 public FirmwareImage GetFirmwareImage(string imageId)
 {
     try
     {
         return(FirmwareImage.Map(Api.FirmwareImageRetrieve(imageId)));
     }
     catch (update_service.Client.ApiException e)
     {
         return(HandleNotFound <FirmwareImage, update_service.Client.ApiException>(e));
     }
 }
コード例 #2
0
 /// <summary>
 /// Creates the firmware image.
 /// </summary>
 /// <returns>The firmware image.</returns>
 /// <param name="dataFile">Path to the data file</param>
 /// <param name="name">Name of the <see cref="FirmwareImage"/></param>
 /// <param name="description">Description of the <see cref="FirmwareImage"/></param>
 /// <exception cref="CloudApiException">CloudApiException</exception>
 /// <example>
 /// <code>
 /// try
 /// {
 ///     var image = updateApI.AddFirmwareImage("FirmwareImage file path", "name of image", "image description");
 ///     return image;
 /// }
 /// catch (CloudApiException)
 /// {
 ///     throw;
 /// }
 /// </code>
 /// </example>
 public FirmwareImage AddFirmwareImage(string dataFile, string name, string description = null)
 {
     try
     {
         using (var fs = File.OpenRead(dataFile))
         {
             var result = FirmwareImage.Map(Api.FirmwareImageCreate(fs, name, description));
             return(result);
         }
     }
     catch (FileNotFoundException e)
     {
         throw new CloudApiException(404, e.Message);
     }
     catch (update_service.Client.ApiException e)
     {
         throw new CloudApiException(e.ErrorCode, e.Message, e.ErrorContent);
     }
 }