private static bool DeleteVault(string vaultName) { using (IAmazonGlacier client = new AmazonGlacierClient(RegionEndpoint.EUWest1)) { DeleteVaultRequest request = new DeleteVaultRequest() { VaultName = vaultName }; DeleteVaultResponse response = client.DeleteVault(request); return (response.HttpStatusCode == System.Net.HttpStatusCode.NoContent); } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Glacier.Model.DeleteVaultRequest(); if (cmdletContext.AccountId != null) { request.AccountId = cmdletContext.AccountId; } 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); }
/// <summary> /// Initiates the asynchronous execution of the DeleteVault operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVault 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<DeleteVaultResponse> DeleteVaultAsync(DeleteVaultRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVaultRequestMarshaller(); var unmarshaller = DeleteVaultResponseUnmarshaller.Instance; return InvokeAsync<DeleteVaultRequest,DeleteVaultResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal DeleteVaultResponse DeleteVault(DeleteVaultRequest request) { var marshaller = new DeleteVaultRequestMarshaller(); var unmarshaller = DeleteVaultResponseUnmarshaller.Instance; return Invoke<DeleteVaultRequest,DeleteVaultResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeleteVault operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVault 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 EndDeleteVault /// operation.</returns> public IAsyncResult BeginDeleteVault(DeleteVaultRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteVaultRequestMarshaller(); var unmarshaller = DeleteVaultResponseUnmarshaller.Instance; return BeginInvoke<DeleteVaultRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the DeleteVault operation. /// <seealso cref="Amazon.Glacier.IAmazonGlacier.DeleteVault"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVault 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<DeleteVaultResponse> DeleteVaultAsync(DeleteVaultRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVaultRequestMarshaller(); var unmarshaller = DeleteVaultResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteVaultRequest, DeleteVaultResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>This operation deletes a vault. Amazon Glacier will delete a vault only if there are no archives in the vault as of the last inventory /// and there have been no writes to the vault since the last inventory. If either of these conditions is not satisfied, the vault deletion /// fails (that is, the vault is not removed) and Amazon Glacier returns an error. You can use DescribeVault to return the number of archives in /// a vault, and you can use <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html">Initiate a Job (POST /// jobs)</a> to initiate a new inventory retrieval for a vault. The inventory contains the archive IDs you use to delete archives using <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html">Delete Archive (DELETE archive)</a> .</para> <para>This /// operation is idempotent.</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-vaults.html">Deleting a Vault in Amazon Glacier</a> and <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-delete.html">Delete Vault </a> in the <i>Amazon Glacier Developer /// Guide</i> . /// </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVault 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 DeleteVaultResponse DeleteVault(DeleteVaultRequest request) { var task = DeleteVaultAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Deletes the specified vault. Before deletion, the vault must be empty of all archives. /// </summary> /// <param name="vaultName">The name of the vault to delete.</param> public void DeleteVault(string vaultName) { DeleteVaultRequest request = new DeleteVaultRequest() { VaultName = vaultName }; request.BeforeRequestEvent += new UserAgentPostFix("DeleteVault").UserAgentRequestEventHandlerSync; this.glacierClient.DeleteVault(request); }
/// <summary> /// <para>This operation deletes a vault. Amazon Glacier will delete a vault only if there are no archives in the vault as of the last inventory /// and there have been no writes to the vault since the last inventory. If either of these conditions is not satisfied, the vault deletion /// fails (that is, the vault is not removed) and Amazon Glacier returns an error. You can use DescribeVault to return the number of archives in /// a vault, and you can use Initiate a Job (POST jobs) to initiate a new inventory retrieval for a vault. The inventory contains the archive /// IDs you use to delete archives using Delete Archive (DELETE archive).</para> <para>This operation is idempotent.</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 a Vault in Amazon Glacier and /// Delete Vault in the <i>Amazon Glacier Developer Guide</i> . /// </para> /// </summary> /// /// <param name="deleteVaultRequest">Container for the necessary parameters to execute the DeleteVault service method on AmazonGlacier.</param> /// /// <exception cref="ResourceNotFoundException"/> /// <exception cref="MissingParameterValueException"/> /// <exception cref="ServiceUnavailableException"/> /// <exception cref="InvalidParameterValueException"/> public DeleteVaultResponse DeleteVault(DeleteVaultRequest deleteVaultRequest) { IAsyncResult asyncResult = invokeDeleteVault(deleteVaultRequest, null, null, true); return EndDeleteVault(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the DeleteVault operation. /// <seealso cref="Amazon.Glacier.AmazonGlacier.DeleteVault"/> /// </summary> /// /// <param name="deleteVaultRequest">Container for the necessary parameters to execute the DeleteVault 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 BeginDeleteVault(DeleteVaultRequest deleteVaultRequest, AsyncCallback callback, object state) { return invokeDeleteVault(deleteVaultRequest, callback, state, false); }
IAsyncResult invokeDeleteVault(DeleteVaultRequest deleteVaultRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DeleteVaultRequestMarshaller().Marshall(deleteVaultRequest); var unmarshaller = DeleteVaultResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>This operation deletes a vault. Amazon Glacier will delete a vault only if there are no archives in the vault as of the last inventory /// and there have been no writes to the vault since the last inventory. If either of these conditions is not satisfied, the vault deletion /// fails (that is, the vault is not removed) and Amazon Glacier returns an error. You can use DescribeVault to return the number of archives in /// a vault, and you can use <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html">Initiate a Job (POST /// jobs)</a> to initiate a new inventory retrieval for a vault. The inventory contains the archive IDs you use to delete archives using <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html">Delete Archive (DELETE archive)</a> .</para> <para>This /// operation is idempotent.</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-vaults.html">Deleting a Vault in Amazon Glacier</a> and <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-delete.html">Delete Vault </a> in the <i>Amazon Glacier Developer /// Guide</i> . /// </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVault 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 DeleteVaultResponse DeleteVault(DeleteVaultRequest request) { var task = DeleteVaultAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
private Amazon.Glacier.Model.DeleteVaultResponse CallAWSServiceOperation(IAmazonGlacier client, Amazon.Glacier.Model.DeleteVaultRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Glacier", "DeleteVault"); try { #if DESKTOP return(client.DeleteVault(request)); #elif CORECLR return(client.DeleteVaultAsync(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> /// Initiates the asynchronous execution of the DeleteVault operation. /// <seealso cref="Amazon.Glacier.IAmazonGlacier.DeleteVault"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteVault 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<DeleteVaultResponse> DeleteVaultAsync(DeleteVaultRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteVaultRequestMarshaller(); var unmarshaller = DeleteVaultResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DeleteVaultRequest, DeleteVaultResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Deletes the specified vault. Before deletion, the vault must be empty of all archives. /// </summary> /// <param name="vaultName">The name of the vault to delete.</param> public void DeleteVault(string vaultName) { DeleteVaultRequest request = new DeleteVaultRequest() { VaultName = vaultName }; ((Amazon.Runtime.Internal.IAmazonWebServiceRequest)request).AddBeforeRequestHandler(new UserAgentPostFix("DeleteVault").UserAgentRequestEventHandlerSync); this.glacierClient.DeleteVault(request); }