Container for the parameters to the InitiateJob operation. This operation initiates a job of the specified type. In this release, you can initiate a job to retrieve either an archive or a vault inventory (a list of archives in a vault).

Retrieving data from Amazon Glacier is a two-step process:

  1. Initiate a retrieval job.

    A data retrieval policy can cause your initiate retrieval job request to fail with a PolicyEnforcedException exception. For more information about data retrieval policies, see Amazon Glacier Data Retrieval Policies. For more information about the PolicyEnforcedException exception, see Error Responses.

  2. After the job completes, download the bytes.

The retrieval request is executed asynchronously. When you initiate a retrieval job, Amazon Glacier creates a job and returns a job ID in the response. When Amazon Glacier completes the job, you can get the job output (archive or inventory data). For information about getting job output, see GetJobOutput operation.

The job must complete before you can get its output. To determine when a job is complete, you have the following options:

  • Use Amazon SNS Notification You can specify an Amazon Simple Notification Service (Amazon SNS) topic to which Amazon Glacier can post a notification after the job is completed. You can specify an SNS topic per job request. The notification is sent only after Amazon Glacier completes the job. In addition to specifying an SNS topic per job request, you can configure vault notifications for a vault so that job notifications are always sent. For more information, see SetVaultNotifications.

  • Get job details You can make a DescribeJob request to obtain job status information while a job is in progress. However, it is more efficient to use an Amazon SNS notification to determine when a job is complete.

The information you get via notification is same that you get by calling DescribeJob.

If for a specific event, you add both the notification configuration on the vault and also specify an SNS topic in your initiate job request, Amazon Glacier sends both notifications. For more information, see SetVaultNotifications.

An AWS account has full permission to perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them explicit permission to perform specific actions. For more information, see Access Control Using AWS Identity and Access Management (IAM).

About the Vault Inventory

Amazon Glacier prepares an inventory for each vault periodically, every 24 hours. When you initiate a job for a vault inventory, Amazon Glacier returns the last inventory for the vault. The inventory data you get might be up to a day or two days old. Also, the initiate inventory job might take some time to complete before you can download the vault inventory. So you do not want to retrieve a vault inventory for each vault operation. However, in some scenarios, you might find the vault inventory useful. For example, when you upload an archive, you can provide an archive description but not an archive name. Amazon Glacier provides you a unique archive ID, an opaque string of characters. So, you might maintain your own database that maps archive names to their corresponding Amazon Glacier assigned archive IDs. You might find the vault inventory useful in the event you need to reconcile information in your database with the actual vault inventory.

Range Inventory Retrieval

You can limit the number of inventory items retrieved by filtering on the archive creation date or by setting a limit.

Filtering by Archive Creation Date

You can retrieve inventory items for archives created between StartDate and EndDate by specifying values for these parameters in the InitiateJob request. Archives created on or after the StartDate and before the EndDate will be returned. If you only provide the StartDate without the EndDate, you will retrieve the inventory for all archives created on or after the StartDate. If you only provide the EndDate without the StartDate, you will get back the inventory for all archives created before the EndDate.

Limiting Inventory Items per Retrieval

You can limit the number of inventory items returned by setting the Limit parameter in the InitiateJob request. The inventory job output will contain inventory items up to the specified Limit. If there are more inventory items available, the result is paginated. After a job is complete you can use the DescribeJob operation to get a marker that you use in a subsequent InitiateJob request. The marker will indicate the starting point to retrieve the next set of inventory items. You can page through your entire inventory by repeatedly making InitiateJob requests with the marker from the previous DescribeJob output, until you get a marker from DescribeJob that returns null, indicating that there are no more inventory items available.

You can use the Limit parameter together with the date range parameters.

About Ranged Archive Retrieval

You can initiate an archive retrieval for the whole archive or a range of the archive. In the case of ranged archive retrieval, you specify a byte range to return or the whole archive. The range specified must be megabyte (MB) aligned, that is the range start value must be divisible by 1 MB and range end value plus 1 must be divisible by 1 MB or equal the end of the archive. If the ranged archive retrieval is not megabyte aligned, this operation returns a 400 response. Furthermore, to ensure you get checksum values for data you download using Get Job Output API, the range must be tree hash aligned.

An AWS account has full permission to perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them explicit permission to perform specific actions. For more information, see Access Control Using AWS Identity and Access Management (IAM).

For conceptual information and the underlying REST API, see Initiate a Job and Downloading a Vault Inventory

Expedited and Bulk Archive Retrievals

When retrieving an archive, you can specify one of the following options in the Tier field of the request body:

  • Standard The default type of retrieval, which allows access to any of your archives within several hours. Standard retrievals typically complete within 3–5 hours.

  • Bulk Amazon Glacier’s lowest-cost retrieval option, which enables you to retrieve large amounts of data inexpensively in a day. Bulk retrieval requests typically complete within 5–12 hours.

  • Expedited Amazon Glacier’s option for the fastest retrievals. Archives requested using the expedited retrievals typically become accessible within 1–5 minutes.

For more information about expedited and bulk retrievals, see Retrieving Amazon Glacier Archives.

Inheritance: AmazonGlacierRequest
        /// <summary>
        /// Initiates the asynchronous execution of the InitiateJob operation.
        /// <seealso cref="Amazon.Glacier.IAmazonGlacier.InitiateJob"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the InitiateJob operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public Task<InitiateJobResponse> InitiateJobAsync(InitiateJobRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new InitiateJobRequestMarshaller();
            var unmarshaller = InitiateJobResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, InitiateJobRequest, InitiateJobResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
 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;
     }
 }
        /// <summary>
        /// <para>This operation initiates a job of the specified type. In this release, you can initiate a job to retrieve either an archive or a vault
        /// inventory (a list of archives in a vault). </para> <para>Retrieving data from Amazon Glacier is a two-step process: </para> <ol> <li>
        /// <para>Initiate a retrieval job.</para> </li>
        /// <li> <para>After the job completes, download the bytes.</para> </li>
        /// </ol> <para>The retrieval request is executed asynchronously. When you initiate a retrieval job, Amazon Glacier creates a job and returns a
        /// job ID in the response. When Amazon Glacier completes the job, you can get the job output (archive or inventory data). For information about
        /// getting job output, see GetJobOutput operation. </para> <para>The job must complete before you can get its output. To determine when a job
        /// is complete, you have the following options:</para>
        /// <ul>
        /// <li> <para> <b>Use Amazon SNS Notification</b> You can specify an Amazon Simple Notification Service (Amazon SNS) topic to which Amazon
        /// Glacier can post a notification after the job is completed. You can specify an SNS topic per job request. The notification is sent only
        /// after Amazon Glacier completes the job. In addition to specifying an SNS topic per job request, you can configure vault notifications for a
        /// vault so that job notifications are always sent. For more information, see SetVaultNotifications.</para> </li>
        /// <li> <para> <b>Get job details</b> You can make a DescribeJob request to obtain job status information while a job is in progress. However,
        /// it is more efficient to use an Amazon SNS notification to determine when a job is complete.</para> </li>
        /// 
        /// </ul>
        /// <para><b>NOTE:</b> The information you get via notification is same that you get by calling DescribeJob. </para> <para>If for a specific
        /// event, you add both the notification configuration on the vault and also specify an SNS topic in your initiate job request, Amazon Glacier
        /// sends both notifications. For more information, see SetVaultNotifications.</para> <para>An AWS account has full permission to perform all
        /// operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them
        /// explicit permission to perform specific actions. For more information, see <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html">Access Control Using AWS Identity and Access
        /// Management (IAM)</a> .</para> <para> <b>About the Vault Inventory</b> </para> <para>Amazon Glacier prepares an inventory for each vault
        /// periodically, every 24 hours. When you initiate a job for a vault inventory, Amazon Glacier returns the last inventory for the vault. The
        /// inventory data you get might be up to a day or two days old. Also, the initiate inventory job might take some time to complete before you
        /// can download the vault inventory. So you do not want to retrieve a vault inventory for each vault operation. However, in some scenarios, you
        /// might find the vault inventory useful. For example, when you upload an archive, you can provide an archive description but not an archive
        /// name. Amazon Glacier provides you a unique archive ID, an opaque string of characters. So, you might maintain your own database that maps
        /// archive names to their corresponding Amazon Glacier assigned archive IDs. You might find the vault inventory useful in the event you need to
        /// reconcile information in your database with the actual vault inventory. </para> <para> <b>Range Inventory Retrieval</b> </para> <para>You
        /// can limit the number of inventory items retrieved by filtering on the archive creation date or by setting a limit.</para> <para>
        /// <i>Filtering by Archive Creation Date</i> </para> <para>You can retrieve inventory items for archives created between <c>StartDate</c> and
        /// <c>EndDate</c> by specifying values for these parameters in the <b>InitiateJob</b> request. Archives created on or after the
        /// <c>StartDate</c> and before the <c>EndDate</c> will be returned. If you only provide the <c>StartDate</c> without the <c>EndDate</c> , you
        /// will retrieve the inventory for all archives created on or after the <c>StartDate</c> . If you only provide the <c>EndDate</c> without the
        /// <c>StartDate</c> , you will get back the inventory for all archives created before the <c>EndDate</c> .</para> <para> <i>Limiting Inventory
        /// Items per Retrieval</i> </para> <para>You can limit the number of inventory items returned by setting the <c>Limit</c> parameter in the
        /// <b>InitiateJob</b> request. The inventory job output will contain inventory items up to the specified <c>Limit</c> . If there are more
        /// inventory items available, the result is paginated. After a job is complete you can use the DescribeJob operation to get a marker that you
        /// use in a subsequent <b>InitiateJob</b> request. The marker will indicate the starting point to retrieve the next set of inventory items. You
        /// can page through your entire inventory by repeatedly making <b>InitiateJob</b> requests with the marker from the previous <b>DescribeJob</b>
        /// output, until you get a marker from <b>DescribeJob</b> that returns null, indicating that there are no more inventory items
        /// available.</para> <para>You can use the <c>Limit</c> parameter together with the date range parameters.</para> <para> <b>About Ranged
        /// Archive Retrieval</b> </para> <para> You can initiate an archive retrieval for the whole archive or a range of the archive. In the case of
        /// ranged archive retrieval, you specify a byte range to return or the whole archive. The range specified must be megabyte (MB) aligned, that
        /// is the range start value must be divisible by 1 MB and range end value plus 1 must be divisible by 1 MB or equal the end of the archive. If
        /// the ranged archive retrieval is not megabyte aligned, this operation returns a 400 response. Furthermore, to ensure you get checksum values
        /// for data you download using Get Job Output API, the range must be tree hash aligned. </para> <para>An AWS account has full permission to
        /// perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must
        /// grant them explicit permission to perform specific actions. For more information, see <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html">Access Control Using AWS Identity and Access
        /// Management (IAM)</a> .</para> <para>For conceptual information and the underlying REST API, go to <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html">Initiate a Job</a> and <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html">Downloading a Vault Inventory</a> </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the InitiateJob service method on AmazonGlacier.</param>
        /// 
        /// <returns>The response from the InitiateJob service method, as returned by AmazonGlacier.</returns>
        /// 
        /// <exception cref="T:Amazon.Glacier.Model.ResourceNotFoundException" />
        /// <exception cref="T:Amazon.Glacier.Model.MissingParameterValueException" />
        /// <exception cref="T:Amazon.Glacier.Model.ServiceUnavailableException" />
        /// <exception cref="T:Amazon.Glacier.Model.InvalidParameterValueException" />
		public InitiateJobResponse InitiateJob(InitiateJobRequest request)
        {
            var task = InitiateJobAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Example #4
0
        /// <summary>
        /// This method initiates an archive retieval job for the specified archive and returns back the job id.
        /// Once the is complete
        /// </summary>
        /// <param name="vaultName">The name of the vault that contains the archive to initiate the job for.</param>
        /// <param name="archiveId">The archive id that the download job will retrieve.</param>
        /// <param name="options">Additional options that can be used for initiating archive retrieval.</param>
        /// <returns>The job id for the initiated job.</returns>
        public string InitiateArchiveRetrievalJob(string vaultName, string archiveId, InitiateArchiveRetrievalOptions options)
        {
            InitiateJobRequest jobRequest = new InitiateJobRequest()
            {
                VaultName = vaultName,
                JobParameters = new JobParameters()
                {
                    ArchiveId = archiveId,
                    Type = "archive-retrieval"
                }
            };

            if (options != null)
            {
                jobRequest.AccountId = options.AccountId;
                jobRequest.JobParameters.SNSTopic = options.SNSTopic;
            }

            var jobId = glacierClient.InitiateJob(jobRequest).InitiateJobResult.JobId;
            return jobId;
        }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Glacier.Model.InitiateJobRequest();

            if (cmdletContext.AccountId != null)
            {
                request.AccountId = cmdletContext.AccountId;
            }

            // populate JobParameters
            var requestJobParametersIsNull = true;

            request.JobParameters = new Amazon.Glacier.Model.JobParameters();
            System.String requestJobParameters_archiveId = null;
            if (cmdletContext.ArchiveId != null)
            {
                requestJobParameters_archiveId = cmdletContext.ArchiveId;
            }
            if (requestJobParameters_archiveId != null)
            {
                request.JobParameters.ArchiveId = requestJobParameters_archiveId;
                requestJobParametersIsNull      = false;
            }
            System.String requestJobParameters_jobDescription = null;
            if (cmdletContext.JobDescription != null)
            {
                requestJobParameters_jobDescription = cmdletContext.JobDescription;
            }
            if (requestJobParameters_jobDescription != null)
            {
                request.JobParameters.Description = requestJobParameters_jobDescription;
                requestJobParametersIsNull        = false;
            }
            System.String requestJobParameters_outputFormat = null;
            if (cmdletContext.OutputFormat != null)
            {
                requestJobParameters_outputFormat = cmdletContext.OutputFormat;
            }
            if (requestJobParameters_outputFormat != null)
            {
                request.JobParameters.Format = requestJobParameters_outputFormat;
                requestJobParametersIsNull   = false;
            }
            Amazon.Glacier.Model.InventoryRetrievalJobInput requestJobParameters_inventoryRetrieval = null;
            if (cmdletContext.InventoryRetrieval != null)
            {
                requestJobParameters_inventoryRetrieval = cmdletContext.InventoryRetrieval;
            }
            if (requestJobParameters_inventoryRetrieval != null)
            {
                request.JobParameters.InventoryRetrievalParameters = requestJobParameters_inventoryRetrieval;
                requestJobParametersIsNull = false;
            }
            Amazon.Glacier.Model.OutputLocation requestJobParameters_outputLocation = null;
            if (cmdletContext.OutputLocation != null)
            {
                requestJobParameters_outputLocation = cmdletContext.OutputLocation;
            }
            if (requestJobParameters_outputLocation != null)
            {
                request.JobParameters.OutputLocation = requestJobParameters_outputLocation;
                requestJobParametersIsNull           = false;
            }
            System.String requestJobParameters_retrievalByteRange = null;
            if (cmdletContext.RetrievalByteRange != null)
            {
                requestJobParameters_retrievalByteRange = cmdletContext.RetrievalByteRange;
            }
            if (requestJobParameters_retrievalByteRange != null)
            {
                request.JobParameters.RetrievalByteRange = requestJobParameters_retrievalByteRange;
                requestJobParametersIsNull = false;
            }
            Amazon.Glacier.Model.SelectParameters requestJobParameters_selectParameter = null;
            if (cmdletContext.SelectParameter != null)
            {
                requestJobParameters_selectParameter = cmdletContext.SelectParameter;
            }
            if (requestJobParameters_selectParameter != null)
            {
                request.JobParameters.SelectParameters = requestJobParameters_selectParameter;
                requestJobParametersIsNull             = false;
            }
            System.String requestJobParameters_sNSTopic = null;
            if (cmdletContext.SNSTopic != null)
            {
                requestJobParameters_sNSTopic = cmdletContext.SNSTopic;
            }
            if (requestJobParameters_sNSTopic != null)
            {
                request.JobParameters.SNSTopic = requestJobParameters_sNSTopic;
                requestJobParametersIsNull     = false;
            }
            System.String requestJobParameters_tier = null;
            if (cmdletContext.Tier != null)
            {
                requestJobParameters_tier = cmdletContext.Tier;
            }
            if (requestJobParameters_tier != null)
            {
                request.JobParameters.Tier = requestJobParameters_tier;
                requestJobParametersIsNull = false;
            }
            System.String requestJobParameters_jobType = null;
            if (cmdletContext.JobType != null)
            {
                requestJobParameters_jobType = cmdletContext.JobType;
            }
            if (requestJobParameters_jobType != null)
            {
                request.JobParameters.Type = requestJobParameters_jobType;
                requestJobParametersIsNull = false;
            }
            // determine if request.JobParameters should be set to null
            if (requestJobParametersIsNull)
            {
                request.JobParameters = null;
            }
            if (cmdletContext.VaultName != null)
            {
                request.VaultName = cmdletContext.VaultName;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
Example #6
0
        internal InitiateJobResponse InitiateJob(InitiateJobRequest request)
        {
            var marshaller = new InitiateJobRequestMarshaller();
            var unmarshaller = InitiateJobResponseUnmarshaller.Instance;

            return Invoke<InitiateJobRequest,InitiateJobResponse>(request, marshaller, unmarshaller);
        }
        public string run()
        {
            if (!KeepRunning())
            {
                return null;
            }

            string jobId;
            using (AmazonGlacierClient client = new AmazonGlacierClient(Mapping.AccessKey, Mapping.SecretKey, Mapping.Endpoint))
            {
                InitiateJobRequest iReq = new InitiateJobRequest();

                iReq.AccountId = "-";
                iReq.VaultName = Mapping.VaultName;
                iReq.JobParameters = getJobParameters();

                try
                {
                    jobId = client.InitiateJob(iReq).InitiateJobResult.JobId;
                    if (SendJobScheduledNotification)
                    {
                        Notification notice = getJobScheduledNotification(jobId);
                        if (notice != null)
                        {
                            notice.publish(Mapping, false);
                        }
                    }
                }
                catch (ResourceNotFoundException)
                {
                    jobId = null;
                }
            }

            return jobId;
        }
 IAsyncResult invokeInitiateJob(InitiateJobRequest initiateJobRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new InitiateJobRequestMarshaller().Marshall(initiateJobRequest);
     var unmarshaller = InitiateJobResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the InitiateJob operation.
 /// <seealso cref="Amazon.Glacier.AmazonGlacier.InitiateJob"/>
 /// </summary>
 /// 
 /// <param name="initiateJobRequest">Container for the necessary parameters to execute the InitiateJob operation on AmazonGlacier.</param>
 /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
 /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 /// 
 /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndInitiateJob
 ///         operation.</returns>
 public IAsyncResult BeginInitiateJob(InitiateJobRequest initiateJobRequest, AsyncCallback callback, object state)
 {
     return invokeInitiateJob(initiateJobRequest, callback, state, false);
 }
        string initiateJob()
        {
            var request = new InitiateJobRequest()
            {
                AccountId = this.options.AccountId,
                VaultName = this.vaultName,
                JobParameters = new JobParameters()
                {
                    ArchiveId = this.archiveId,
                    SNSTopic = topicArn,
                    Type = "archive-retrieval"
                }
            };
            ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(new ArchiveTransferManager.UserAgentPostFix("DownloadArchive").UserAgentRequestEventHandlerSync);

            var response = this.manager.GlacierClient.InitiateJob(request);
            return response.JobId;
        }
 /// <summary>
 /// <para>This operation initiates a job of the specified type. In this release, you can initiate a job to retrieve either an archive or a vault
 /// inventory (a list of archives in a vault). </para> <para>Retrieving data from Amazon Glacier is a two-step process: </para> <ol> <li>
 /// <para>Initiate a retrieval job.</para> </li>
 /// <li> <para>After the job completes, download the bytes.</para> </li>
 /// </ol> <para>The retrieval request is executed asynchronously. When you initiate a retrieval job, Amazon Glacier creates a job and returns a
 /// job ID in the response. When Amazon Glacier completes the job, you can get the job output (archive or inventory data). For information about
 /// getting job output, see GetJobOutput operation. </para> <para>The job must complete before you can get its output. To determine when a job
 /// is complete, you have the following options:</para>
 /// <ul>
 /// <li> <para> <b>Use Amazon SNS Notification</b> You can specify an Amazon Simple Notification Service (Amazon SNS) topic to which Amazon
 /// Glacier can post a notification after the job is completed. You can specify an SNS topic per job request. The notification is sent only
 /// after Amazon Glacier completes the job. In addition to specifying an SNS topic per job request, you can configure vault notifications for a
 /// vault so that job notifications are always sent. For more information, see SetVaultNotificationConfiguration.</para> </li>
 /// <li> <para> <b>Get job details</b> You can make a DescribeJob request to obtain job status information while a job is in progress. However,
 /// it is more efficient to use an Amazon SNS notification to determine when a job is complete.</para> </li>
 /// 
 /// </ul>
 /// <para><b>NOTE:</b> The information you get via notification is same that you get by calling DescribeJob. </para> <para>If for a specific
 /// event, you add both the notification configuration on the vault and also specify an SNS topic in your initiate job request, Amazon Glacier
 /// sends both notifications. For more information, see SetVaultNotificationConfiguration.</para> <para>An AWS account has full permission to
 /// perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must
 /// grant them explicit permission to perform specific actions. For more information, see Access Control Using AWS Identity and Access
 /// Management (IAM).</para> <para> <b>About the Vault Inventory</b> </para> <para>Amazon Glacier prepares an inventory for each vault
 /// periodically, every 24 hours. When you initiate a job for a vault inventory, Amazon Glacier returns the last inventory for the vault. The
 /// inventory data you get might be up to a day or two days old. Also, the initiate inventory job might take some time to complete before you
 /// can download the vault inventory. So you do not want to retrieve a vault inventory for each vault operation. However, in some scenarios, you
 /// might find the vault inventory useful. For example, when you upload an archive, you can provide an archive description but not an archive
 /// name. Amazon Glacier provides you a unique archive ID, an opaque string of characters. So, you might maintain your own database that maps
 /// archive names to their corresponding Amazon Glacier assigned archive IDs. You might find the vault inventory useful in the event you need to
 /// reconcile information in your database with the actual vault inventory. </para> <para>An AWS account has full permission to perform all
 /// operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them
 /// explicit permission to perform specific actions. For more information, see Access Control Using AWS Identity and Access Management
 /// (IAM).</para> <para>For conceptual information and the underlying REST API, go to Initiate a Job and Downloading a Vault Inventory </para>
 /// </summary>
 /// 
 /// <param name="initiateJobRequest">Container for the necessary parameters to execute the InitiateJob service method on AmazonGlacier.</param>
 /// 
 /// <returns>The response from the InitiateJob service method, as returned by AmazonGlacier.</returns>
 /// 
 /// <exception cref="ResourceNotFoundException"/>
 /// <exception cref="MissingParameterValueException"/>
 /// <exception cref="ServiceUnavailableException"/>
 /// <exception cref="InvalidParameterValueException"/>
 public InitiateJobResponse InitiateJob(InitiateJobRequest initiateJobRequest)
 {
     IAsyncResult asyncResult = invokeInitiateJob(initiateJobRequest, null, null, true);
     return EndInitiateJob(asyncResult);
 }
        /// <summary>
        /// <para>This operation initiates a job of the specified type. In this release, you can initiate a job to retrieve either an archive or a vault
        /// inventory (a list of archives in a vault). </para> <para>Retrieving data from Amazon Glacier is a two-step process: </para> <ol> <li>
        /// <para>Initiate a retrieval job.</para> </li>
        /// <li> <para>After the job completes, download the bytes.</para> </li>
        /// </ol> <para>The retrieval request is executed asynchronously. When you initiate a retrieval job, Amazon Glacier creates a job and returns a
        /// job ID in the response. When Amazon Glacier completes the job, you can get the job output (archive or inventory data). For information about
        /// getting job output, see GetJobOutput operation. </para> <para>The job must complete before you can get its output. To determine when a job
        /// is complete, you have the following options:</para>
        /// <ul>
        /// <li> <para> <b>Use Amazon SNS Notification</b> You can specify an Amazon Simple Notification Service (Amazon SNS) topic to which Amazon
        /// Glacier can post a notification after the job is completed. You can specify an SNS topic per job request. The notification is sent only
        /// after Amazon Glacier completes the job. In addition to specifying an SNS topic per job request, you can configure vault notifications for a
        /// vault so that job notifications are always sent. For more information, see SetVaultNotifications.</para> </li>
        /// <li> <para> <b>Get job details</b> You can make a DescribeJob request to obtain job status information while a job is in progress. However,
        /// it is more efficient to use an Amazon SNS notification to determine when a job is complete.</para> </li>
        /// 
        /// </ul>
        /// <para><b>NOTE:</b> The information you get via notification is same that you get by calling DescribeJob. </para> <para>If for a specific
        /// event, you add both the notification configuration on the vault and also specify an SNS topic in your initiate job request, Amazon Glacier
        /// sends both notifications. For more information, see SetVaultNotifications.</para> <para>An AWS account has full permission to perform all
        /// operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must grant them
        /// explicit permission to perform specific actions. For more information, see <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html">Access Control Using AWS Identity and Access
        /// Management (IAM)</a> .</para> <para> <b>About the Vault Inventory</b> </para> <para>Amazon Glacier prepares an inventory for each vault
        /// periodically, every 24 hours. When you initiate a job for a vault inventory, Amazon Glacier returns the last inventory for the vault. The
        /// inventory data you get might be up to a day or two days old. Also, the initiate inventory job might take some time to complete before you
        /// can download the vault inventory. So you do not want to retrieve a vault inventory for each vault operation. However, in some scenarios, you
        /// might find the vault inventory useful. For example, when you upload an archive, you can provide an archive description but not an archive
        /// name. Amazon Glacier provides you a unique archive ID, an opaque string of characters. So, you might maintain your own database that maps
        /// archive names to their corresponding Amazon Glacier assigned archive IDs. You might find the vault inventory useful in the event you need to
        /// reconcile information in your database with the actual vault inventory. </para> <para> <b>Range Inventory Retrieval</b> </para> <para>You
        /// can limit the number of inventory items retrieved by filtering on the archive creation date or by setting a limit.</para> <para>
        /// <i>Filtering by Archive Creation Date</i> </para> <para>You can retrieve inventory items for archives created between <c>StartDate</c> and
        /// <c>EndDate</c> by specifying values for these parameters in the <b>InitiateJob</b> request. Archives created on or after the
        /// <c>StartDate</c> and before the <c>EndDate</c> will be returned. If you only provide the <c>StartDate</c> without the <c>EndDate</c> , you
        /// will retrieve the inventory for all archives created on or after the <c>StartDate</c> . If you only provide the <c>EndDate</c> without the
        /// <c>StartDate</c> , you will get back the inventory for all archives created before the <c>EndDate</c> .</para> <para> <i>Limiting Inventory
        /// Items per Retrieval</i> </para> <para>You can limit the number of inventory items returned by setting the <c>Limit</c> parameter in the
        /// <b>InitiateJob</b> request. The inventory job output will contain inventory items up to the specified <c>Limit</c> . If there are more
        /// inventory items available, the result is paginated. After a job is complete you can use the DescribeJob operation to get a marker that you
        /// use in a subsequent <b>InitiateJob</b> request. The marker will indicate the starting point to retrieve the next set of inventory items. You
        /// can page through your entire inventory by repeatedly making <b>InitiateJob</b> requests with the marker from the previous <b>DescribeJob</b>
        /// output, until you get a marker from <b>DescribeJob</b> that returns null, indicating that there are no more inventory items
        /// available.</para> <para>You can use the <c>Limit</c> parameter together with the date range parameters.</para> <para> <b>About Ranged
        /// Archive Retrieval</b> </para> <para> You can initiate an archive retrieval for the whole archive or a range of the archive. In the case of
        /// ranged archive retrieval, you specify a byte range to return or the whole archive. The range specified must be megabyte (MB) aligned, that
        /// is the range start value must be divisible by 1 MB and range end value plus 1 must be divisible by 1 MB or equal the end of the archive. If
        /// the ranged archive retrieval is not megabyte aligned, this operation returns a 400 response. Furthermore, to ensure you get checksum values
        /// for data you download using Get Job Output API, the range must be tree hash aligned. </para> <para>An AWS account has full permission to
        /// perform all operations (actions). However, AWS Identity and Access Management (IAM) users don't have any permissions by default. You must
        /// grant them explicit permission to perform specific actions. For more information, see <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html">Access Control Using AWS Identity and Access
        /// Management (IAM)</a> .</para> <para>For conceptual information and the underlying REST API, go to <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html">Initiate a Job</a> and <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html">Downloading a Vault Inventory</a> </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the InitiateJob service method on AmazonGlacier.</param>
        /// 
        /// <returns>The response from the InitiateJob service method, as returned by AmazonGlacier.</returns>
        /// 
        /// <exception cref="T:Amazon.Glacier.Model.ResourceNotFoundException" />
        /// <exception cref="T:Amazon.Glacier.Model.MissingParameterValueException" />
        /// <exception cref="T:Amazon.Glacier.Model.ServiceUnavailableException" />
        /// <exception cref="T:Amazon.Glacier.Model.InvalidParameterValueException" />
		public InitiateJobResponse InitiateJob(InitiateJobRequest request)
        {
            var task = InitiateJobAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
 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;
     }
 }
        /// <summary>
        /// Initiates the asynchronous execution of the InitiateJob operation.
        /// <seealso cref="Amazon.Glacier.IAmazonGlacier.InitiateJob"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the InitiateJob operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
		public async Task<InitiateJobResponse> InitiateJobAsync(InitiateJobRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new InitiateJobRequestMarshaller();
            var unmarshaller = InitiateJobResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, InitiateJobRequest, InitiateJobResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        string initiateJob()
        {
            var request = new InitiateJobRequest()
            {
                AccountId = this.options.AccountId,
                VaultName = this.vaultName,
                JobParameters = new JobParameters()
                {
                    ArchiveId = this.archiveId,
                    SNSTopic = topicArn,
                    Type = "archive-retrieval"
                }
            };
            request.BeforeRequestEvent += new UserAgentPostFix("DownloadArchive").UserAgentRequestEventHandlerSync;

            var response = this.manager.GlacierClient.InitiateJob(request);
            return response.JobId;
        }
Example #16
0
        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;
        }
Example #17
0
        /// <summary>
        /// Initiates the asynchronous execution of the InitiateJob operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the InitiateJob operation on AmazonGlacierClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndInitiateJob
        ///         operation.</returns>
        public IAsyncResult BeginInitiateJob(InitiateJobRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new InitiateJobRequestMarshaller();
            var unmarshaller = InitiateJobResponseUnmarshaller.Instance;

            return BeginInvoke<InitiateJobRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Example #18
0
        public string InitiateVaultInventoryRequest()
        {
            InitiateJobRequest inventoryRequest = new InitiateJobRequest()
            {
                VaultName = _vault,
                JobParameters = new JobParameters()
                {
                    Type = "inventory-retrieval"
                }
            };

            InitiateJobResponse response = _amazonGlacierClient.InitiateJob(inventoryRequest);
            return response.InitiateJobResult.JobId;
        }
Example #19
0
        /// <summary>
        /// Initiates the asynchronous execution of the InitiateJob operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the InitiateJob operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<InitiateJobResponse> InitiateJobAsync(InitiateJobRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new InitiateJobRequestMarshaller();
            var unmarshaller = InitiateJobResponseUnmarshaller.Instance;

            return InvokeAsync<InitiateJobRequest,InitiateJobResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// This method initiates an archive retieval job for the specified archive and returns back the job id.
        /// Once the job is complete
        /// </summary>
        /// <param name="vaultName">The name of the vault that contains the archive to initiate the job for.</param>
        /// <param name="archiveId">The archive id that the download job will retrieve.</param>
        /// <param name="options">Additional options that can be used for initiating archive retrieval.</param>
        /// <returns>The job id for the initiated job.</returns>
        public async Task<string> InitiateArchiveRetrievalJobAsync(string vaultName, string archiveId, InitiateArchiveRetrievalOptions options)
        { 
            InitiateJobRequest jobRequest = new InitiateJobRequest()
            {
                VaultName = vaultName,
                JobParameters = new JobParameters()
                {
                    ArchiveId = archiveId,
                    Type = "archive-retrieval"
                }
            };

            if (options != null)
            {
                jobRequest.AccountId = options.AccountId;
                jobRequest.JobParameters.SNSTopic = options.SNSTopic;
            }

            var glacierClientTask = await glacierClient.InitiateJobAsync(jobRequest).ConfigureAwait(false);
            return glacierClientTask.JobId;
        }