public async Task RunActivity( [ActivityTrigger] Project project, ILogger log) { if (project is null) { throw new ArgumentNullException(nameof(project)); } using (log.BeginProjectScope(project)) { try { await github .DeleteTeamCloudProject(project) .ConfigureAwait(false); } catch (Exception exc) { log.LogError(exc, $"{nameof(ProjectDeleteActivity)} failed: {exc.Message}"); throw exc.AsSerializable(); } } }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "delete", Route = "test/{projectName}")] HttpRequestMessage httpRequest, string projectName, ILogger log) { if (httpRequest is null) { throw new ArgumentNullException(nameof(httpRequest)); } // log.LogWarning(Secrets.Log()); var guid = Guid.NewGuid().ToString(); var project = new Project { Id = guid, Name = projectName, Users = new List <User> { new User { Id = "1ab004bb-57c6-4217-b3cf-f63d090e5b28", Role = TeamCloudUserRole.Admin, ProjectMemberships = new List <ProjectMembership> { new ProjectMembership { ProjectId = guid, Role = ProjectUserRole.Owner, Properties = new Dictionary <string, string> { { "GitHubLogin", "colbylwilliams" } } } }, Properties = new Dictionary <string, string> { { "GitHubLogin", "colbylwilliams" } } } } }; if (httpRequest.Method == HttpMethod.Get) { var(team, repo, proj) = await github.CreateTeamCloudProject(project) .ConfigureAwait(false); log.LogWarning(team.ToString()); log.LogWarning(repo.ToString()); log.LogWarning(proj.ToString()); } else if (httpRequest.Method == HttpMethod.Delete) { await github.DeleteTeamCloudProject(project) .ConfigureAwait(false); } return(new OkResult()); }