public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonIdentityManagementServiceConfig config = new AmazonIdentityManagementServiceConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonIdentityManagementServiceClient client = new AmazonIdentityManagementServiceClient(creds, config); ListInstanceProfilesResponse resp = new ListInstanceProfilesResponse(); do { ListInstanceProfilesRequest req = new ListInstanceProfilesRequest { Marker = resp.Marker , MaxItems = maxItems }; resp = client.ListInstanceProfiles(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.InstanceProfiles) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.Marker)); }
public static async Task <IList <InstanceProfile> > FindExistingInstanceProfilesAsync(IAmazonIdentityManagementService iamClient, int maxRoles) { var profiles = new List <InstanceProfile>(); ListInstanceProfilesRequest request = new ListInstanceProfilesRequest(); ListInstanceProfilesResponse response = null; do { if (response != null) { request.Marker = response.Marker; } response = await iamClient.ListInstanceProfilesAsync(request).ConfigureAwait(false); foreach (var profile in response.InstanceProfiles) { profiles.Add(profile); } } while (response.IsTruncated && profiles.Count < maxRoles); return(profiles); }
public Task <ListInstanceProfilesResponse> ListInstanceProfilesAsync(ListInstanceProfilesRequest request, CancellationToken cancellationToken = new CancellationToken()) { throw new System.NotImplementedException(); }