public static List<GlacierJobDescription> listJobs(FolderVaultMapping mapping) { using (AmazonGlacierClient client = new AmazonGlacierClient(mapping.AccessKey, mapping.SecretKey, mapping.Endpoint)) { ListJobsRequest req = new ListJobsRequest(); req.AccountId = "-"; req.Completed = false; req.VaultName = mapping.VaultName; return client.ListJobs(req).ListJobsResult.JobList; } }
/// <summary> /// Initiates the asynchronous execution of the ListJobs operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListJobs 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 EndListJobs /// operation.</returns> public IAsyncResult BeginListJobs(ListJobsRequest request, AsyncCallback callback, object state) { var marshaller = new ListJobsRequestMarshaller(); var unmarshaller = ListJobsResponseUnmarshaller.Instance; return BeginInvoke<ListJobsRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>This operation lists jobs for a vault, including jobs that are in-progress and jobs that have recently finished. </para> /// <para><b>NOTE:</b> Amazon Glacier retains recently completed jobs for a period before deleting them; however, it eventually removes /// completed jobs. The output of completed jobs can be retrieved. Retaining completed jobs for a period of time after they have completed /// enables you to get a job output in the event you miss the job completion notification or your first attempt to download it fails. For /// example, suppose you start an archive retrieval job to download an archive. After the job completes, you start to download the archive but /// encounter a network error. In this scenario, you can retry and download the archive while the job exists. </para> <para>To retrieve an /// archive or retrieve a vault inventory from Amazon Glacier, you first initiate a job, and after the job completes, you download the data. For /// an archive retrieval, the output is the archive data, and for an inventory retrieval, it is the inventory list. The List Job operation /// returns a list of these jobs sorted by job initiation time.</para> <para>This List Jobs operation supports pagination. By default, this /// operation returns up to 1,000 jobs in the response. You should always check the response for a <c>marker</c> at which to continue the list; /// if there are no more items the <c>marker</c> is <c>null</c> . /// To return a list of jobs that begins at a specific job, set the <c>marker</c> request parameter to the value you obtained from a /// previous List Jobs request. You can also limit the number of jobs returned in the response by specifying the <c>limit</c> parameter in the /// request.</para> <para>Additionally, you can filter the jobs list returned by specifying an optional <c>statuscode</c> (InProgress, /// Succeeded, or Failed) and <c>completed</c> (true, false) parameter. The <c>statuscode</c> allows you to specify that only jobs that match a /// specified status are returned. The <c>completed</c> parameter allows you to specify that only jobs in a specific completion state are /// returned.</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 the underlying REST API, go to <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-jobs-get.html">List Jobs </a> </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListJobs service method on AmazonGlacier.</param> /// /// <returns>The response from the ListJobs 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 ListJobsResponse ListJobs(ListJobsRequest request) { var task = ListJobsAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
/// <summary> /// Initiates the asynchronous execution of the ListJobs operation. /// <seealso cref="Amazon.Glacier.IAmazonGlacier.ListJobs"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListJobs 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<ListJobsResponse> ListJobsAsync(ListJobsRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListJobsRequestMarshaller(); var unmarshaller = ListJobsResponseUnmarshaller.GetInstance(); return Invoke<IRequest, ListJobsRequest, ListJobsResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the ListJobs operation. /// <seealso cref="Amazon.Glacier.AmazonGlacier.ListJobs"/> /// </summary> /// /// <param name="listJobsRequest">Container for the necessary parameters to execute the ListJobs 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 EndListJobs /// operation.</returns> public IAsyncResult BeginListJobs(ListJobsRequest listJobsRequest, AsyncCallback callback, object state) { return invokeListJobs(listJobsRequest, callback, state, false); }
IAsyncResult invokeListJobs(ListJobsRequest listJobsRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new ListJobsRequestMarshaller().Marshall(listJobsRequest); var unmarshaller = ListJobsResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>This operation lists jobs for a vault, including jobs that are in-progress and jobs that have recently finished. </para> /// <para><b>NOTE:</b> Amazon Glacier retains recently completed jobs for a period before deleting them; however, it eventually removes /// completed jobs. The output of completed jobs can be retrieved. Retaining completed jobs for a period of time after they have completed /// enables you to get a job output in the event you miss the job completion notification or your first attempt to download it fails. For /// example, suppose you start an archive retrieval job to download an archive. After the job completes, you start to download the archive but /// encounter a network error. In this scenario, you can retry and download the archive while the job exists. </para> <para>To retrieve an /// archive or retrieve a vault inventory from Amazon Glacier, you first initiate a job, and after the job completes, you download the data. For /// an archive retrieval, the output is the archive data, and for an inventory retrieval, it is the inventory list. The List Job operation /// returns a list of these jobs sorted by job initiation time.</para> <para>This List Jobs operation supports pagination. By default, this /// operation returns up to 1,000 jobs in the response. You should always check the response for a <c>marker</c> at which to continue the list; /// if there are no more items the <c>marker</c> is <c>null</c> . /// To return a list of jobs that begins at a specific job, set the <c>marker</c> request parameter to the value you obtained from a /// previous List Jobs request. You can also limit the number of jobs returned in the response by specifying the <c>limit</c> parameter in the /// request.</para> <para>Additionally, you can filter the jobs list returned by specifying an optional <c>statuscode</c> (InProgress, /// Succeeded, or Failed) and <c>completed</c> (true, false) parameter. The <c>statuscode</c> allows you to specify that only jobs that match a /// specified status are returned. The <c>completed</c> parameter allows you to specify that only jobs in a specific completion state are /// returned.</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 the underlying REST API, go to List Jobs /// </para> /// </summary> /// /// <param name="listJobsRequest">Container for the necessary parameters to execute the ListJobs service method on AmazonGlacier.</param> /// /// <returns>The response from the ListJobs service method, as returned by AmazonGlacier.</returns> /// /// <exception cref="ResourceNotFoundException"/> /// <exception cref="MissingParameterValueException"/> /// <exception cref="ServiceUnavailableException"/> /// <exception cref="InvalidParameterValueException"/> public ListJobsResponse ListJobs(ListJobsRequest listJobsRequest) { IAsyncResult asyncResult = invokeListJobs(listJobsRequest, null, null, true); return EndListJobs(asyncResult); }
private Amazon.Glacier.Model.ListJobsResponse CallAWSServiceOperation(IAmazonGlacier client, Amazon.Glacier.Model.ListJobsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Glacier", "ListJobs"); try { #if DESKTOP return(client.ListJobs(request)); #elif CORECLR return(client.ListJobsAsync(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 lists jobs for a vault, including jobs that are in-progress and jobs that have recently finished. </para> /// <para><b>NOTE:</b> Amazon Glacier retains recently completed jobs for a period before deleting them; however, it eventually removes /// completed jobs. The output of completed jobs can be retrieved. Retaining completed jobs for a period of time after they have completed /// enables you to get a job output in the event you miss the job completion notification or your first attempt to download it fails. For /// example, suppose you start an archive retrieval job to download an archive. After the job completes, you start to download the archive but /// encounter a network error. In this scenario, you can retry and download the archive while the job exists. </para> <para>To retrieve an /// archive or retrieve a vault inventory from Amazon Glacier, you first initiate a job, and after the job completes, you download the data. For /// an archive retrieval, the output is the archive data, and for an inventory retrieval, it is the inventory list. The List Job operation /// returns a list of these jobs sorted by job initiation time.</para> <para>This List Jobs operation supports pagination. By default, this /// operation returns up to 1,000 jobs in the response. You should always check the response for a <c>marker</c> at which to continue the list; /// if there are no more items the <c>marker</c> is <c>null</c> . /// To return a list of jobs that begins at a specific job, set the <c>marker</c> request parameter to the value you obtained from a /// previous List Jobs request. You can also limit the number of jobs returned in the response by specifying the <c>limit</c> parameter in the /// request.</para> <para>Additionally, you can filter the jobs list returned by specifying an optional <c>statuscode</c> (InProgress, /// Succeeded, or Failed) and <c>completed</c> (true, false) parameter. The <c>statuscode</c> allows you to specify that only jobs that match a /// specified status are returned. The <c>completed</c> parameter allows you to specify that only jobs in a specific completion state are /// returned.</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 the underlying REST API, go to <a href="http://docs.aws.amazon.com/amazonglacier/latest/dev/api-jobs-get.html">List Jobs </a> </para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListJobs service method on AmazonGlacier.</param> /// /// <returns>The response from the ListJobs 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 ListJobsResponse ListJobs(ListJobsRequest request) { var task = ListJobsAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; #pragma warning disable CS0618, CS0612 //A class member was marked with the Obsolete attribute var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent; #pragma warning restore CS0618, CS0612 //A class member was marked with the Obsolete attribute // create request and set iteration invariants var request = new Amazon.Glacier.Model.ListJobsRequest(); if (cmdletContext.AccountId != null) { request.AccountId = cmdletContext.AccountId; } if (cmdletContext.Completed != null) { request.Completed = cmdletContext.Completed.Value; } if (cmdletContext.Limit != null) { request.Limit = AutoIterationHelpers.ConvertEmitLimitToServiceTypeInt32(cmdletContext.Limit.Value); } if (cmdletContext.Statuscode != null) { request.Statuscode = cmdletContext.Statuscode; } if (cmdletContext.VaultName != null) { request.VaultName = cmdletContext.VaultName; } // Initialize loop variant and commence piping var _nextToken = cmdletContext.Marker; var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; _nextToken = response.Marker; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; var useParameterSelect = this.Select.StartsWith("^") || this.PassThru.IsPresent; // create request and set iteration invariants var request = new Amazon.Glacier.Model.ListJobsRequest(); if (cmdletContext.AccountId != null) { request.AccountId = cmdletContext.AccountId; } if (cmdletContext.Completed != null) { request.Completed = cmdletContext.Completed.Value; } if (cmdletContext.Statuscode != null) { request.Statuscode = cmdletContext.Statuscode; } if (cmdletContext.VaultName != null) { request.VaultName = cmdletContext.VaultName; } // Initialize loop variants and commence piping System.String _nextToken = null; int? _emitLimit = null; int _retrievedSoFar = 0; if (AutoIterationHelpers.HasValue(cmdletContext.Marker)) { _nextToken = cmdletContext.Marker; } if (cmdletContext.Limit.HasValue) { // The service has a maximum page size of 50. If the user has // asked for more items than page max, and there is no page size // configured, we rely on the service ignoring the set maximum // and giving us 50 items back. If a page size is set, that will // be used to configure the pagination. // We'll make further calls to satisfy the user's request. _emitLimit = cmdletContext.Limit; } var _userControllingPaging = this.NoAutoIteration.IsPresent || ParameterWasBound(nameof(this.Marker)); var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); do { request.Marker = _nextToken; if (_emitLimit.HasValue) { int correctPageSize = Math.Min(50, _emitLimit.Value); request.Limit = AutoIterationHelpers.ConvertEmitLimitToInt32(correctPageSize); } else if (!ParameterWasBound(nameof(this.Limit))) { request.Limit = AutoIterationHelpers.ConvertEmitLimitToInt32(50); } CmdletOutput output; try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; if (!useParameterSelect) { pipelineOutput = cmdletContext.Select(response, this); } output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; int _receivedThisCall = response.JobList.Count; _nextToken = response.Marker; _retrievedSoFar += _receivedThisCall; if (_emitLimit.HasValue) { _emitLimit -= _receivedThisCall; } } catch (Exception e) { if (_retrievedSoFar == 0 || !_emitLimit.HasValue) { output = new CmdletOutput { ErrorResponse = e }; } else { break; } } ProcessOutput(output); } while (!_userControllingPaging && AutoIterationHelpers.HasValue(_nextToken) && (!_emitLimit.HasValue || _emitLimit.Value >= 1)); if (useParameterSelect) { WriteObject(cmdletContext.Select(null, this)); } return(null); }
private static List<GlacierJobDescription> ListInventory(string vaultName) { using (IAmazonGlacier client = new AmazonGlacierClient(RegionEndpoint.EUWest1)) { ListJobsRequest request = new ListJobsRequest() { VaultName = vaultName }; ListJobsResponse response = client.ListJobs(request); return response.JobList; } }
/// <summary> /// Initiates the asynchronous execution of the ListJobs operation. /// <seealso cref="Amazon.Glacier.IAmazonGlacier.ListJobs"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListJobs 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<ListJobsResponse> ListJobsAsync(ListJobsRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListJobsRequestMarshaller(); var unmarshaller = ListJobsResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, ListJobsRequest, ListJobsResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Paginator for ListJobs operation ///</summary> public IListJobsPaginator ListJobs(ListJobsRequest request) { return(new ListJobsPaginator(this.client, request)); }
internal ListJobsResponse ListJobs(ListJobsRequest request) { var marshaller = new ListJobsRequestMarshaller(); var unmarshaller = ListJobsResponseUnmarshaller.Instance; return Invoke<ListJobsRequest,ListJobsResponse>(request, marshaller, unmarshaller); }
internal ListJobsPaginator(IAmazonGlacier client, ListJobsRequest request) { this._client = client; this._request = request; }
/// <summary> /// Initiates the asynchronous execution of the ListJobs operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListJobs 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<ListJobsResponse> ListJobsAsync(ListJobsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListJobsRequestMarshaller(); var unmarshaller = ListJobsResponseUnmarshaller.Instance; return InvokeAsync<ListJobsRequest,ListJobsResponse>(request, marshaller, unmarshaller, cancellationToken); }
public ListJobsResult ListJobs() { AmazonGlacierClient client = new AmazonGlacierClient(awsCredentials, glacierConfig); ListJobsRequest request = new ListJobsRequest().WithVaultName(vaultName); ListJobsResponse response = client.ListJobs(request); System.Console.WriteLine(response.ListJobsResult.JobList.Count); return response.ListJobsResult; }