static void RequestVaultInventory(IAmazonGlacier glacier) { // This sample method forces Glacier to start inventorying the new vault // created by the sample. Glacier's default behavior is to inventory a // vault once every 24 hours. Vaults cannot be deleted unless (1) they // are empty and (2) there has been no write activity since the last // inventory. By requesting an inventory ahead of schedule, it allows // you the user to delete the sample vault created by this code earlier. // Note that it can take Glacier a few hours to finish inventory processing. var req = new InitiateJobRequest { VaultName = VaultName, JobParameters = new JobParameters { Type = "inventory-retrieval" } }; Task <InitiateJobResponse> res = glacier.InitiateJobAsync(req); Task.WaitAll(res); if (res.IsCompletedSuccessfully) { Console.WriteLine($"Inventory job for vault {VaultName} has been queued. On completion you may delete the vault assuming no further write activity takes place."); } }
public async Task BeginVaultInventoryRetrieval(string vaultName, string notificationTargetTopicId) { vaultName = GetTrimmedVaultName(vaultName); var response = await _glacier.InitiateJobAsync(new InitiateJobRequest { VaultName = vaultName, JobParameters = new JobParameters { Type = "inventory-retrieval", SNSTopic = notificationTargetTopicId } }); _logger.LogDebug("Job ID: {0}", response.JobId); }
private Amazon.Glacier.Model.InitiateJobResponse CallAWSServiceOperation(IAmazonGlacier client, Amazon.Glacier.Model.InitiateJobRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Glacier", "InitiateJob"); try { #if DESKTOP return(client.InitiateJob(request)); #elif CORECLR return(client.InitiateJobAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }