public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonRedshiftConfig config = new AmazonRedshiftConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonRedshiftClient client = new AmazonRedshiftClient(creds, config);

            DescribeEventsResponse resp = new DescribeEventsResponse();

            do
            {
                DescribeEventsRequest req = new DescribeEventsRequest
                {
                    Marker = resp.Marker
                    ,
                    MaxRecords = maxItems
                };

                resp = client.DescribeEvents(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Events)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.Marker));
        }
Ejemplo n.º 2
0
        protected IAmazonRedshift CreateClient(AWSCredentials credentials, RegionEndpoint region)
        {
            var config = new AmazonRedshiftConfig {
                RegionEndpoint = region
            };

            Amazon.PowerShell.Utils.Common.PopulateConfig(this, config);
            this.CustomizeClientConfig(config);
            var client = new AmazonRedshiftClient(credentials, config);

            client.BeforeRequestEvent += RequestEventHandler;
            client.AfterResponseEvent += ResponseEventHandler;
            return(client);
        }
Ejemplo n.º 3
0
        private OperationResult EstablishClient(AddonManifest manifest, RedshiftDeveloperOptions devOptions, out AmazonRedshiftClient client)
        {
            OperationResult result;

            bool requireCreds;
            var  manifestprops   = manifest.GetProperties().ToDictionary(x => x.Key, x => x.Value);
            var  AccessKey       = manifestprops["AWSClientKey"];
            var  SecretAccessKey = manifestprops["AWSSecretKey"];
            var  _RegionEndpoint = manifestprops["AWSRegionEndpoint"];

            var prop =
                manifest.Properties.First(
                    p => p.Key.Equals("requireDevCredentials", StringComparison.InvariantCultureIgnoreCase));

            if (bool.TryParse(prop.Value, out requireCreds) && requireCreds)
            {
                if (!ValidateDevCreds(devOptions))
                {
                    client = null;
                    result = new OperationResult()
                    {
                        IsSuccess      = false,
                        EndUserMessage =
                            "The add on requires that developer credentials are specified but none were provided."
                    };
                    return(result);
                }
            }
            AmazonRedshiftConfig config = new AmazonRedshiftConfig()
            {
                RegionEndpoint = RegionEndpoint.USEast1
            };

            client = new AmazonRedshiftClient(AccessKey, SecretAccessKey, config);
            result = new OperationResult {
                IsSuccess = true
            };
            return(result);
        }