public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonElasticBeanstalkConfig config = new AmazonElasticBeanstalkConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonElasticBeanstalkClient client = new AmazonElasticBeanstalkClient(creds, config); ListPlatformVersionsResponse resp = new ListPlatformVersionsResponse(); do { ListPlatformVersionsRequest req = new ListPlatformVersionsRequest { NextToken = resp.NextToken , MaxRecords = maxItems }; resp = client.ListPlatformVersions(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.PlatformSummaryList) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public async Task<List<PlatformSummary>> GetElasticBeanstalkPlatformArns(OrchestratorSession session) { var beanstalkClient = _awsClientFactory.GetAWSClient<IAmazonElasticBeanstalk>(session.AWSCredentials, session.AWSRegion); var request = new ListPlatformVersionsRequest { Filters = new List<PlatformFilter> { new PlatformFilter { Operator = "=", Type = "PlatformStatus", Values = { "Ready" } } } }; var response = await beanstalkClient.ListPlatformVersionsAsync(request); var platformVersions = new List<PlatformSummary>(); foreach (var version in response.PlatformSummaryList) { if (string.IsNullOrEmpty(version.PlatformCategory) || string.IsNullOrEmpty(version.PlatformBranchLifecycleState)) continue; if (!version.PlatformBranchLifecycleState.Equals("Supported")) continue; if (!version.PlatformCategory.Equals(".NET Core")) continue; platformVersions.Add(version); } return platformVersions; }