/// <summary> /// Creates an insance of CognitoSyncStorage. /// </summary> /// <param name="cognitoCredentials"><see cref="Amazon.CognitoIdentity.CognitoAWSCredentials"/></param> /// <param name="config"><see cref="Amazon.CognitoSync.AmazonCognitoSyncConfig"/></param> public CognitoSyncStorage(CognitoAWSCredentials cognitoCredentials, AmazonCognitoSyncConfig config) { if (cognitoCredentials == null) { throw new ArgumentNullException("cognitoCredentials"); } this.identityPoolId = cognitoCredentials.IdentityPoolId; this.cognitoCredentials = cognitoCredentials; this.client = new AmazonCognitoSyncClient(cognitoCredentials, config); }
private static IEnumerable <Dataset> GetAllDatasetsHelper(IAmazonCognitoSync client, string poolId, string identityId) { var request = new ListDatasetsRequest { MaxResults = MaxResults, IdentityPoolId = poolId, IdentityId = identityId }; ListDatasetsResponse result; do { result = client.ListDatasets(request); foreach (var ds in result.Datasets) { yield return(ds); } request.NextToken = result.NextToken; } while (!string.IsNullOrEmpty(result.NextToken)); }
private static IEnumerable <Record> GetAllRecordsHelper(IAmazonCognitoSync client, string datasetName, string poolId, string identityId) { var request = new ListRecordsRequest { MaxResults = MaxResults, DatasetName = datasetName, IdentityPoolId = poolId, IdentityId = identityId, }; ListRecordsResponse result; do { result = client.ListRecords(request); foreach (var record in result.Records) { yield return(record); } request.NextToken = result.NextToken; } while (!string.IsNullOrEmpty(result.NextToken)); }
private Amazon.CognitoSync.Model.ListRecordsResponse CallAWSServiceOperation(IAmazonCognitoSync client, Amazon.CognitoSync.Model.ListRecordsRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Sync", "ListRecords"); try { #if DESKTOP return(client.ListRecords(request)); #elif CORECLR return(client.ListRecordsAsync(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; } }
public static List <Dataset> GetAllDatasets(IAmazonCognitoSync client, string poolId, string identityId) { return(GetAllDatasetsHelper(client, poolId, identityId).ToList()); }
public static List <Record> GetAllRecords(IAmazonCognitoSync client, string datasetName, string poolId, string identityId) { return(GetAllRecordsHelper(client, datasetName, poolId, identityId).ToList()); }
protected override void ProcessRecord() { base.ProcessRecord(); Client = CreateClient(_CurrentCredentials, _RegionEndpoint); }