Container for the parameters to the DeleteArchive operation.

This operation deletes an archive from a vault. Subsequent requests to initiate a retrieval of this archive will fail. Archive retrievals that are in progress for this archive ID may or may not succeed according to the following scenarios:

  • If the archive retrieval job is actively preparing the data for download when Amazon Glacier receives the delete archive request, the archival retrieval operation might fail.
  • If the archive retrieval job has successfully prepared the archive for download when Amazon Glacier receives the delete archive request, you will be able to download the output.

This operation is idempotent. Attempting to delete an already-deleted archive does not result in an error.

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 underlying REST API, go to Deleting an Archive in Amazon Glacier and Delete Archive in the Amazon Glacier Developer Guide .

Inheritance: AmazonGlacierRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Glacier.Model.DeleteArchiveRequest();

            if (cmdletContext.AccountId != null)
            {
                request.AccountId = cmdletContext.AccountId;
            }
            if (cmdletContext.ArchiveId != null)
            {
                request.ArchiveId = cmdletContext.ArchiveId;
            }
            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);
        }
 private static bool DeleteArchive(string vaultName, string archiveId)
 {
     try
     {
         using (IAmazonGlacier client = new AmazonGlacierClient(RegionEndpoint.EUWest1))
         {
             DeleteArchiveRequest request = new DeleteArchiveRequest()
             {
                 VaultName = vaultName,
                 ArchiveId = archiveId
             };
             DeleteArchiveResponse response = client.DeleteArchive(request);
             return (response.HttpStatusCode == System.Net.HttpStatusCode.NoContent);
         }
     }
     catch (ResourceNotFoundException)
     {
         return true; // already removed
     }
 }
Example #3
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteArchive operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteArchive 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<DeleteArchiveResponse> DeleteArchiveAsync(DeleteArchiveRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteArchiveRequestMarshaller();
            var unmarshaller = DeleteArchiveResponseUnmarshaller.Instance;

            return InvokeAsync<DeleteArchiveRequest,DeleteArchiveResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Example #4
0
        internal DeleteArchiveResponse DeleteArchive(DeleteArchiveRequest request)
        {
            var marshaller = new DeleteArchiveRequestMarshaller();
            var unmarshaller = DeleteArchiveResponseUnmarshaller.Instance;

            return Invoke<DeleteArchiveRequest,DeleteArchiveResponse>(request, marshaller, unmarshaller);
        }
Example #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteArchive operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteArchive 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 EndDeleteArchive
        ///         operation.</returns>
        public IAsyncResult BeginDeleteArchive(DeleteArchiveRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DeleteArchiveRequestMarshaller();
            var unmarshaller = DeleteArchiveResponseUnmarshaller.Instance;

            return BeginInvoke<DeleteArchiveRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteArchive operation.
        /// <seealso cref="Amazon.Glacier.IAmazonGlacier.DeleteArchive"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteArchive 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<DeleteArchiveResponse> DeleteArchiveAsync(DeleteArchiveRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteArchiveRequestMarshaller();
            var unmarshaller = DeleteArchiveResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, DeleteArchiveRequest, DeleteArchiveResponse>(request, marshaller, unmarshaller, signer, cancellationToken);
        }
        /// <summary>
        /// <para>This operation deletes an archive from a vault. Subsequent requests to initiate a retrieval of this archive will fail. Archive
        /// retrievals that are in progress for this archive ID may or may not succeed according to the following scenarios:</para>
        /// <ul>
        /// <li>If the archive retrieval job is actively preparing the data for download when Amazon Glacier receives the delete archive request, the
        /// archival retrieval operation might fail. </li>
        /// <li>If the archive retrieval job has successfully prepared the archive for download when Amazon Glacier receives the delete archive
        /// request, you will be able to download the output. </li>
        /// 
        /// </ul>
        /// <para>This operation is idempotent. Attempting to delete an already-deleted archive does not result in an error. </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 underlying REST API, go to <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-an-archive.html">Deleting an Archive in Amazon Glacier</a> and <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html">Delete Archive</a> in the <i>Amazon Glacier Developer
        /// Guide</i> .
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteArchive service method on
        /// AmazonGlacier.</param>
        /// 
        /// <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 DeleteArchiveResponse DeleteArchive(DeleteArchiveRequest request)
        {
            var task = DeleteArchiveAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
Example #8
0
 /// <summary>
 /// Deletes an archive specified by vault name and archive ID.
 /// </summary>
 /// <param name="vaultName">The name of the vault containing the archive.</param>
 /// <param name="archiveId">The archive ID of the archive to delete.</param>
 public void DeleteArchive(string vaultName, string archiveId)
 {
     DeleteArchiveRequest request = new DeleteArchiveRequest() { VaultName = vaultName, ArchiveId = archiveId };
     request.BeforeRequestEvent += new UserAgentPostFix("DeleteArchive").UserAgentRequestEventHandlerSync;
     this.glacierClient.DeleteArchive(request);
 }
 /// <summary>
 /// <para>This operation deletes an archive from a vault. Subsequent requests to initiate a retrieval of this archive will fail. Archive
 /// retrievals that are in progress for this archive ID may or may not succeed according to the following scenarios:</para>
 /// <ul>
 /// <li>If the archive retrieval job is actively preparing the data for download when Amazon Glacier receives the delete archive request, the
 /// archival retrieval operation might fail. </li>
 /// <li>If the archive retrieval job has successfully prepared the archive for download when Amazon Glacier receives the delete archive
 /// request, you will be able to download the output. </li>
 /// 
 /// </ul>
 /// <para>This operation is idempotent. Attempting to delete an already-deleted archive does not result in an error. </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 underlying REST API, go to Deleting an Archive in
 /// Amazon Glacier and Delete Archive in the <i>Amazon Glacier Developer Guide</i> .
 /// </para>
 /// </summary>
 /// 
 /// <param name="deleteArchiveRequest">Container for the necessary parameters to execute the DeleteArchive service method on
 ///          AmazonGlacier.</param>
 /// 
 /// <exception cref="ResourceNotFoundException"/>
 /// <exception cref="MissingParameterValueException"/>
 /// <exception cref="ServiceUnavailableException"/>
 /// <exception cref="InvalidParameterValueException"/>
 public DeleteArchiveResponse DeleteArchive(DeleteArchiveRequest deleteArchiveRequest)
 {
     IAsyncResult asyncResult = invokeDeleteArchive(deleteArchiveRequest, null, null, true);
     return EndDeleteArchive(asyncResult);
 }
 /// <summary>
 /// Initiates the asynchronous execution of the DeleteArchive operation.
 /// <seealso cref="Amazon.Glacier.AmazonGlacier.DeleteArchive"/>
 /// </summary>
 /// 
 /// <param name="deleteArchiveRequest">Container for the necessary parameters to execute the DeleteArchive 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>
 public IAsyncResult BeginDeleteArchive(DeleteArchiveRequest deleteArchiveRequest, AsyncCallback callback, object state)
 {
     return invokeDeleteArchive(deleteArchiveRequest, callback, state, false);
 }
 IAsyncResult invokeDeleteArchive(DeleteArchiveRequest deleteArchiveRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new DeleteArchiveRequestMarshaller().Marshall(deleteArchiveRequest);
     var unmarshaller = DeleteArchiveResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 private Amazon.Glacier.Model.DeleteArchiveResponse CallAWSServiceOperation(IAmazonGlacier client, Amazon.Glacier.Model.DeleteArchiveRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Glacier", "DeleteArchive");
     try
     {
         #if DESKTOP
         return(client.DeleteArchive(request));
         #elif CORECLR
         return(client.DeleteArchiveAsync(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 deletes an archive from a vault. Subsequent requests to initiate a retrieval of this archive will fail. Archive
        /// retrievals that are in progress for this archive ID may or may not succeed according to the following scenarios:</para>
        /// <ul>
        /// <li>If the archive retrieval job is actively preparing the data for download when Amazon Glacier receives the delete archive request, the
        /// archival retrieval operation might fail. </li>
        /// <li>If the archive retrieval job has successfully prepared the archive for download when Amazon Glacier receives the delete archive
        /// request, you will be able to download the output. </li>
        /// 
        /// </ul>
        /// <para>This operation is idempotent. Attempting to delete an already-deleted archive does not result in an error. </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 underlying REST API, go to <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-an-archive.html">Deleting an Archive in Amazon Glacier</a> and <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html">Delete Archive</a> in the <i>Amazon Glacier Developer
        /// Guide</i> .
        /// </para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteArchive service method on
        /// AmazonGlacier.</param>
        /// 
        /// <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 DeleteArchiveResponse DeleteArchive(DeleteArchiveRequest request)
        {
            var task = DeleteArchiveAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteArchive operation.
        /// <seealso cref="Amazon.Glacier.IAmazonGlacier.DeleteArchive"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteArchive 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<DeleteArchiveResponse> DeleteArchiveAsync(DeleteArchiveRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteArchiveRequestMarshaller();
            var unmarshaller = DeleteArchiveResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, DeleteArchiveRequest, DeleteArchiveResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
 /// <summary>
 /// Deletes an archive specified by vault name and archive ID.
 /// </summary>
 /// <param name="vaultName">The name of the vault containing the archive.</param>
 /// <param name="archiveId">The archive ID of the archive to delete.</param>
 public void DeleteArchive(string vaultName, string archiveId)
 {
     DeleteArchiveRequest request = new DeleteArchiveRequest() { VaultName = vaultName, ArchiveId = archiveId };
     ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(new UserAgentPostFix("DeleteArchive").UserAgentRequestEventHandlerSync);
     this.glacierClient.DeleteArchive(request);
 }