Amazon.Glacier.Transfer.ArchiveTransferManager.CreateVault C# (CSharp) Метод

CreateVault() публичный Метод

Creates a vault.
public CreateVault ( string vaultName ) : void
vaultName string The name of the vault to create.
Результат void
        public void CreateVault(string vaultName)
        {
            CreateVaultRequest request = new CreateVaultRequest() { VaultName = vaultName };
            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(new UserAgentPostFix("CreateVault").UserAgentRequestEventHandlerSync);
            this.glacierClient.CreateVault(request);
        }

Usage Example

Пример #1
0
        static void Main(string[] args)
        {
            if (CheckRequiredFields())
            {                
                using (manager = new ArchiveTransferManager(RegionEndpoint.USWest2))
                {
                    try
                    {
                        // Creates a new Vault
                        Console.WriteLine("Create Vault");
                        manager.CreateVault(vaultName);

                        // Uploads the specified file to Glacier.
                        Console.WriteLine("Upload a Archive");
                        var uploadResult = manager.Upload(vaultName, "Archive Description", filePath);
                        archiveId = uploadResult.ArchiveId;
                        Console.WriteLine("Upload successful. Archive Id : {0}  Checksum : {1}",
                            uploadResult.ArchiveId, uploadResult.Checksum);

                        // Downloads the file from Glacier 
                        // This operation can take a long time to complete. 
                        // The ArchiveTransferManager.Download() method creates an Amazon SNS topic, 
                        // and an Amazon SQS queue that is subscribed to that topic. 
                        // It then initiates the archive retrieval job and polls the queue for the 
                        // archive to be available. This polling takes about 4 hours.
                        // Once the archive is available, download will begin.
                        Console.WriteLine("Download the Archive");
                        var options = new DownloadOptions();
                        options.StreamTransferProgress += OnProgress;
                        manager.Download(vaultName, archiveId, downloadFilePath, options);

                        Console.WriteLine("Delete the Archive");
                        manager.DeleteArchive(vaultName, archiveId);

                    }
                    catch (AmazonGlacierException e)
                    {
                        Console.WriteLine(e.Message);
                    }
                    catch (AmazonServiceException e)
                    {
                        Console.WriteLine(e.Message);
                    }
                }
            }
        }
All Usage Examples Of Amazon.Glacier.Transfer.ArchiveTransferManager::CreateVault