Exemplo n.º 1
0
        private AWSCredentials GetCredentials(AuthenticationResultType authenticationResult)
        {
            Amazon.CognitoIdentity.CognitoAWSCredentials credentials = new Amazon.CognitoIdentity.CognitoAWSCredentials(ConfigurationManager.AppSettings["IDENITYPOOL_ID"], FallbackRegionFactory.GetRegionEndpoint());

            credentials.AddLogin(ConfigurationManager.AppSettings["IDENITY_PROVIDER"], authenticationResult.IdToken);

            return(credentials);
        }
Exemplo n.º 2
0
        private void connectToAmazon()
        {
            if (client == null || !lastCredentials.Equals(CognitoCredentials))
            {
                if (string.IsNullOrEmpty(CognitoCredentials))
                {
                    Debug.LogError("Credentials must not be null or empty!");
                }
                else
                {
                    lastCredentials = CognitoCredentials;

                    Amazon.CognitoIdentity.CognitoAWSCredentials credentials = new Amazon.CognitoIdentity.CognitoAWSCredentials(CognitoCredentials, getAWSEndpoint);
                    client = new Amazon.Polly.AmazonPollyClient(credentials, getAWSEndpoint);
                }
            }
        }
        private async Task fetchData()
        {
            var credentials = new Amazon.CognitoIdentity.CognitoAWSCredentials("arn:aws:iam::963244653868:role/Cognito_ITS440ProjUnauth_Role", Amazon.RegionEndpoint.USEast1);
            var ddbClient   = new Amazon.DynamoDBv2.AmazonDynamoDBClient(credentials, Amazon.RegionEndpoint.USEast1);

            var results = await ddbClient.ScanAsync(new ScanRequest
            {
                TableName       = "Recipes",
                AttributesToGet = new List <string> {
                    "id", "title", "yield", "ingredientsBlobbed", "instructionsBlobbed", "tagsBlobbed"
                }
            });

            Data = results.Items.Select(i => new
            {
                id    = i["id"].S,
                title = i["title"].S,
                yield = i["yield"].S,
                ingredientsBlobbed  = i["ingredientsBlobbed"].S,
                instructionsBlobbed = i["instructionsBlobbed"].S,
                tagsBlobbed         = i["tagsBlobbed"]
            }).OrderBy(i => i.id);
        }