internal virtual ListRecordsResponse ListRecords(ListRecordsRequest request) { var marshaller = ListRecordsRequestMarshaller.Instance; var unmarshaller = ListRecordsResponseUnmarshaller.Instance; return(Invoke <ListRecordsRequest, ListRecordsResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Gets paginated records, optionally changed after a particular sync count for a dataset /// and identity. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListRecords service method.</param> /// /// <returns>The response from the ListRecords service method, as returned by CognitoSync.</returns> /// <exception cref="InternalErrorException"> /// Indicates an internal service error. /// </exception> /// <exception cref="InvalidParameterException"> /// Thrown when a request parameter does not comply with the associated constraints. /// </exception> /// <exception cref="NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="TooManyRequestsException"> /// Thrown if the request is throttled. /// </exception> public ListRecordsResponse ListRecords(ListRecordsRequest request) { var marshaller = new ListRecordsRequestMarshaller(); var unmarshaller = ListRecordsResponseUnmarshaller.Instance; return(Invoke <ListRecordsRequest, ListRecordsResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the ListRecords operation. /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListRecords 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 <ListRecordsResponse> ListRecordsAsync(ListRecordsRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new ListRecordsRequestMarshaller(); var unmarshaller = ListRecordsResponseUnmarshaller.Instance; return(Invoke <IRequest, ListRecordsRequest, ListRecordsResponse>(request, marshaller, unmarshaller, signer, cancellationToken)); }
IAsyncResult invokeListRecords(ListRecordsRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new ListRecordsRequestMarshaller(); var unmarshaller = ListRecordsResponseUnmarshaller.Instance; return(Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer)); }
/// <summary> /// Initiates the asynchronous execution of the ListRecords operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListRecords 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cognito-sync-2014-06-30/ListRecords">REST API Reference for ListRecords Operation</seealso> public virtual Task <ListRecordsResponse> ListRecordsAsync(ListRecordsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = ListRecordsRequestMarshaller.Instance; var unmarshaller = ListRecordsResponseUnmarshaller.Instance; return(InvokeAsync <ListRecordsRequest, ListRecordsResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the ListRecords operation. /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListRecords operation on AmazonCognitoSyncClient.</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 EndListRecords /// operation.</returns> public IAsyncResult BeginListRecords(ListRecordsRequest request, AsyncCallback callback, object state) { var marshaller = new ListRecordsRequestMarshaller(); var unmarshaller = ListRecordsResponseUnmarshaller.Instance; return(BeginInvoke <ListRecordsRequest>(request, marshaller, unmarshaller, callback, state)); }
private void PopulateListUpdatesAsync(string datasetName, long lastSyncCount, List <Record> records, string nextToken, AmazonCognitoSyncCallback <DatasetUpdates> callback, AsyncOptions options) { ListRecordsRequest request = new ListRecordsRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; request.LastSyncCount = lastSyncCount; // mark it large enough to reduce # of requests request.MaxResults = 1024; request.NextToken = nextToken; client.ListRecordsAsync(request, (responseObj) => { ListRecordsResponse res = responseObj.Response; Exception ex = responseObj.Exception; object obj = responseObj.state; if (ex != null) { InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult <DatasetUpdates>(null, ex, obj)), options);; } else { ListRecordsResponse listRecordsResponse = res; foreach (Amazon.CognitoSync.Model.Record remoteRecord in listRecordsResponse.Records) { //builder.addRecord(modelToRecord(remoteRecord)); records.Add(this.ModelToRecord(remoteRecord)); } if (listRecordsResponse.NextToken == null) { DatasetUpdates updates = new DatasetUpdates( datasetName, records, listRecordsResponse.DatasetSyncCount, listRecordsResponse.SyncSessionToken, listRecordsResponse.DatasetExists, listRecordsResponse.DatasetDeletedAfterRequestedSyncCount, listRecordsResponse.MergedDatasetNames ); InternalSDKUtils.AsyncExecutor(() => callback(new AmazonCognitoSyncResult <DatasetUpdates>(updates, ex, obj)), options); return; } // update last evaluated key nextToken = listRecordsResponse.NextToken; // emulating the while loop PopulateListUpdatesAsync(datasetName, lastSyncCount, records, nextToken, callback, new AsyncOptions() { ExecuteCallbackOnMainThread = false, State = obj }); } }, options); }
/// <summary> /// Initiates the asynchronous execution of the ListRecords operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListRecords 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/cognito-sync-2014-06-30/ListRecords">REST API Reference for ListRecords Operation</seealso> public virtual Task <ListRecordsResponse> ListRecordsAsync(ListRecordsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListRecordsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListRecordsResponseUnmarshaller.Instance; return(InvokeAsync <ListRecordsResponse>(request, options, cancellationToken)); }
internal virtual ListRecordsResponse ListRecords(ListRecordsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListRecordsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListRecordsResponseUnmarshaller.Instance; return(Invoke <ListRecordsResponse>(request, options)); }
private void PopulateListUpdates(string datasetName, long lastSyncCount, List <Record> records, string nextToken, AmazonCognitoCallback callback, object state) { { ListRecordsRequest request = new ListRecordsRequest(); //appendUserAgent(request, userAgent); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; request.LastSyncCount = lastSyncCount; // mark it large enough to reduce # of requests request.MaxResults = 1024; request.NextToken = nextToken; client.ListRecordsAsync(request, delegate(AmazonServiceResult result) { if (result.Exception != null) { AmazonMainThreadDispatcher.ExecCallback(callback, new AmazonCognitoResult(null, HandleException(result.Exception, "Failed to list records in dataset: " + datasetName), state)); return; } ListRecordsResponse listRecordsResponse = result.Response as ListRecordsResponse; foreach (Amazon.CognitoSync.Model.Record remoteRecord in listRecordsResponse.Records) { //builder.addRecord(modelToRecord(remoteRecord)); records.Add(this.ModelToRecord(remoteRecord)); } if (listRecordsResponse.NextToken == null) { DatasetUpdatesImpl updates = new DatasetUpdatesImpl( datasetName, records, listRecordsResponse.DatasetSyncCount, listRecordsResponse.SyncSessionToken, listRecordsResponse.DatasetExists, listRecordsResponse.DatasetDeletedAfterRequestedSyncCount, listRecordsResponse.MergedDatasetNames ); ListUpdatesResponse listUpdatesResponse = new ListUpdatesResponse { DatasetUpdates = updates }; AmazonMainThreadDispatcher.ExecCallback(callback, new AmazonCognitoResult(listUpdatesResponse, null, state)); return; } // update last evaluated key nextToken = listRecordsResponse.NextToken; // emulating the while loop PopulateListUpdates(datasetName, lastSyncCount, records, nextToken, callback, state); }, state); } }
private ListRecordsRequest PrepareListRecordsRequest(string datasetName, long lastSyncCount) { ListRecordsRequest request = new ListRecordsRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; request.LastSyncCount = lastSyncCount; // mark it large enough to reduce # of requests request.MaxResults = 1024; return(request); }
internal ListRecordsResponse ListRecords(ListRecordsRequest request) { var task = ListRecordsAsync(request); try { return(task.Result); } catch (AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return(null); } }
/// <summary> /// Initiates the asynchronous execution of the ListRecords operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListRecords operation on AmazonCognitoSyncClient.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">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 void ListRecordsAsync(ListRecordsRequest request, AmazonServiceCallback <ListRecordsRequest, ListRecordsResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new ListRecordsRequestMarshaller(); var unmarshaller = ListRecordsResponseUnmarshaller.Instance; Action <AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if (callback != null) { callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult <ListRecordsRequest, ListRecordsResponse> responseObject = new AmazonServiceResult <ListRecordsRequest, ListRecordsResponse>((ListRecordsRequest)req, (ListRecordsResponse)res, ex, ao.State); callback(responseObject); } } ; BeginInvoke <ListRecordsRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
private DatasetUpdates PopulateListUpdates(string datasetName, long lastSyncCount, List <Record> records, string nextToken) { ListRecordsRequest request = new ListRecordsRequest(); request.IdentityPoolId = identityPoolId; request.IdentityId = this.GetCurrentIdentityId(); request.DatasetName = datasetName; request.LastSyncCount = lastSyncCount; // mark it large enough to reduce # of requests request.MaxResults = 1024; request.NextToken = nextToken; ListRecordsResponse listRecordsResponse = client.ListRecords(request); foreach (Amazon.CognitoSync.Model.Record remoteRecord in listRecordsResponse.Records) { records.Add(ModelToRecord(remoteRecord)); } if (listRecordsResponse.NextToken != null) { // update last evaluated key nextToken = listRecordsResponse.NextToken; PopulateListUpdates(datasetName, lastSyncCount, records, nextToken); } DatasetUpdates updates = new DatasetUpdates( datasetName, records, listRecordsResponse.DatasetSyncCount, listRecordsResponse.SyncSessionToken, listRecordsResponse.DatasetExists, listRecordsResponse.DatasetDeletedAfterRequestedSyncCount, listRecordsResponse.MergedDatasetNames ); return(updates); }
private static IEnumerable <Record> GetAllRecordsHelper(string datasetName, string poolId, string identityId) { var request = new ListRecordsRequest { MaxResults = MaxResults, DatasetName = datasetName, IdentityPoolId = poolId, IdentityId = identityId, }; ListRecordsResult result; do { result = Client.ListRecords(request); foreach (var record in result.Records) { yield return(record); } request.NextToken = result.NextToken; } while (!string.IsNullOrEmpty(result.NextToken)); }
protected override void ProcessRecord() { base.ProcessRecord(); ListRecordsRequest request; try { request = new ListRecordsRequest { CompartmentId = CompartmentId, DatasetId = DatasetId, LifecycleState = LifecycleState, Name = Name, Id = Id, IsLabeled = IsLabeled, AnnotationLabelsContains = AnnotationLabelsContains, Limit = Limit, Page = Page, SortOrder = SortOrder, SortBy = SortBy, OpcRequestId = OpcRequestId }; IEnumerable <ListRecordsResponse> responses = GetRequestDelegate().Invoke(request); foreach (var item in responses) { response = item; WriteOutput(response, response.RecordCollection, true); } if (!ParameterSetName.Equals(AllPageSet) && !ParameterSetName.Equals(LimitSet) && response.OpcNextPage != null) { WriteWarning("This operation supports pagination and not all resources were returned. Re-run using the -All option to auto paginate and list all resources."); } FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Initiates the asynchronous execution of the ListRecords operation. /// <seealso cref="Amazon.CognitoSync.IAmazonCognitoSync"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the ListRecords operation on AmazonCognitoSyncClient.</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 EndListRecords /// operation.</returns> public IAsyncResult BeginListRecords(ListRecordsRequest request, AsyncCallback callback, object state) { return(invokeListRecords(request, callback, state, false)); }
/// <summary> /// Gets paginated records, optionally changed after a particular sync count for a dataset /// and identity. /// </summary> /// <param name="request">Container for the necessary parameters to execute the ListRecords service method.</param> /// /// <returns>The response from the ListRecords service method, as returned by CognitoSync.</returns> /// <exception cref="InternalErrorException"> /// Indicates an internal service error. /// </exception> /// <exception cref="InvalidParameterException"> /// Thrown when a request parameter does not comply with the associated constraints. /// </exception> /// <exception cref="NotAuthorizedException"> /// Thrown when a user is not authorized to access the requested resource. /// </exception> /// <exception cref="TooManyRequestsException"> /// Thrown if the request is throttled. /// </exception> public ListRecordsResponse ListRecords(ListRecordsRequest request) { IAsyncResult asyncResult = invokeListRecords(request, null, null, true); return(EndListRecords(asyncResult)); }