private static async Task AddUsersToAdminGroup(IAmazonIdentityManagementService client, CancellationToken token) { CreateGroupRequest groupRequest = new CreateGroupRequest("Admins"); CreateGroupResponse response = await client.CreateGroupAsync(groupRequest, token); AddUserToGroupRequest request = new AddUserToGroupRequest("Admins", SomeUser); var foo = await client.AddUserToGroupAsync(request, token); request = new AddUserToGroupRequest("Admins", AnotherUser); foo = await client.AddUserToGroupAsync(request, token); }
private Amazon.IdentityManagement.Model.CreateGroupResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.CreateGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "CreateGroup"); try { #if DESKTOP return(client.CreateGroup(request)); #elif CORECLR return(client.CreateGroupAsync(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; } }