示例#1
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            InitiateJobResponse response = new InitiateJobResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            InitiateJobResponse response = new InitiateJobResponse();

            context.Read();

            response.InitiateJobResult = InitiateJobResultUnmarshaller.GetInstance().Unmarshall(context);

            return(response);
        }
示例#3
0
 private static void UnmarshallResult(JsonUnmarshallerContext context, InitiateJobResponse response)
 {
     if (context.ResponseData.GetHeaderValue("Location") != null)
     {
         response.Location = context.ResponseData.GetHeaderValue("Location");
     }
     if (context.ResponseData.GetHeaderValue("x-amz-job-id") != null)
     {
         response.JobId = context.ResponseData.GetHeaderValue("x-amz-job-id");
     }
     return;
 }
示例#4
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            InitiateJobResponse response = new InitiateJobResponse();

            if (context.ResponseData.IsHeaderPresent("x-amz-job-id"))
            {
                response.JobId = context.ResponseData.GetHeaderValue("x-amz-job-id");
            }
            if (context.ResponseData.IsHeaderPresent("Location"))
            {
                response.Location = context.ResponseData.GetHeaderValue("Location");
            }

            return(response);
        }
        public string InitiateVaultInventoryRequest()
        {
            InitiateJobRequest inventoryRequest = new InitiateJobRequest()
            {
                VaultName     = _vault,
                JobParameters = new JobParameters()
                {
                    Type = "inventory-retrieval"
                }
            };

            InitiateJobResponse response = _amazonGlacierClient.InitiateJob(inventoryRequest);

            return(response.InitiateJobResult.JobId);
        }
        public string InitiateDownloadRequest(string archiveId, string snsTopic = "")
        {
            InitiateJobRequest initDownloadRequest = new InitiateJobRequest()
            {
                VaultName     = _vault,
                JobParameters = new JobParameters()
                {
                    Type      = "archive-retrieval",
                    ArchiveId = archiveId
                }
            };

            InitiateJobResponse response = _amazonGlacierClient.InitiateJob(initDownloadRequest);

            return(response.InitiateJobResult.JobId);
        }
示例#7
0
        public async Task <IActionResult> StartInventory()
        {
            InitiateJobRequest request = new InitiateJobRequest
            {
                VaultName     = S3Settings.VaultName,
                JobParameters = new JobParameters
                {
                    Type   = "inventory-retrieval",
                    Format = "JSON"
                }
            };

            InitiateJobResponse response = await GlacierClient.InitiateJobAsync(request);

            return(Ok(response.JobId));
        }
示例#8
0
        public async Task <IActionResult> StartArchiveRetrieval(string archiveId)
        {
            InitiateJobRequest request = new InitiateJobRequest
            {
                VaultName     = S3Settings.VaultName,
                JobParameters = new JobParameters
                {
                    Type      = "archive-retrieval",
                    ArchiveId = archiveId
                }
            };

            InitiateJobResponse response = await GlacierClient.InitiateJobAsync(request);

            return(Ok(response.JobId));
        }
示例#9
0
 private static string RequestInventory(string vaultName)
 {
     using (IAmazonGlacier client = new AmazonGlacierClient(RegionEndpoint.EUWest1))
     {
         InitiateJobRequest initJobRequest = new InitiateJobRequest()
         {
             VaultName     = vaultName,
             JobParameters = new JobParameters()
             {
                 Type   = "inventory-retrieval",
                 Format = "CSV"
             }
         };
         InitiateJobResponse initJobResponse = client.InitiateJob(initJobRequest);
         return(initJobResponse.JobId);
     }
 }
示例#10
0
        static string GetVaultInventoryJobId(string vaultName, AmazonGlacierClient client)
        {
            // Initiate job.
            InitiateJobRequest initJobRequest = new InitiateJobRequest()
            {
                VaultName     = vaultName,
                JobParameters = new JobParameters()
                {
                    Type        = "inventory-retrieval",
                    Description = DateTime.Now.ToString() + ": This job is to download a vault inventory.",
                    SNSTopic    = topicArn,
                }
            };

            InitiateJobResponse initJobResponse = client.InitiateJob(initJobRequest);
            string jobId = initJobResponse.JobId;

            return(jobId);
        }
        static void GetVaultInventory(AmazonGlacierClient client, Amazon.RegionEndpoint region)
        {
            // Initiate job.
            InitiateJobRequest initJobRequest = new InitiateJobRequest()
            {
                VaultName     = s_vaultName,
                JobParameters = new JobParameters()
                {
                    Type        = "inventory-retrieval",
                    Description = "This job is to download a vault inventory.",
                    SNSTopic    = s_topicArn,
                }
            };

            InitiateJobResponse initJobResponse = client.InitiateJob(initJobRequest);
            string jobId = initJobResponse.JobId;

            // Check queue for a message and if job completed successfully, download inventory.
            ProcessQueue(jobId, client, region);
        }
示例#12
0
        static void RetrieveArchive(AmazonGlacier client, AWSArchiveRquest request)
        {
            // Initiate job.
            InitiateJobRequest initJobRequest = new InitiateJobRequest()
            {
                VaultName     = vaultName,
                JobParameters = new JobParameters()
                {
                    Type        = "archive-retrieval",
                    ArchiveId   = request.ArchiveID,
                    Description = "This job is to download archive updated as part of getting started",
                    SNSTopic    = topicArn,
                }
            };
            InitiateJobResponse initJobResponse = client.InitiateJob(initJobRequest);
            string jobId = initJobResponse.InitiateJobResult.JobId;

            // Check queue for a message and if job completed successfully, download archive.
            ProcessQueue(jobId, client, request);
        }
        public void Execute()
        {
            var initJobRequest = new InitiateJobRequest
            {
                VaultName = "backup-home",

                JobParameters = new JobParameters
                {
                    Type = "inventory-retrieval"
                }
            };

            using (AmazonGlacierClient client = new AmazonGlacierClient(RegionEndpoint.USWest2))
            {
                InitiateJobResponse initJobResponse = client.InitiateJob(initJobRequest);

                string jobId = initJobResponse.JobId;

                ConsoleView.Show("Inventory requested");
                ConsoleView.Show(string.Format("JobId: [{0}]", jobId));
            }
        }