public RunbookEditor CreateOrModify(ProjectResource project, string name, string description) { var existing = repository.FindByName(project, name); if (existing == null) { Instance = repository.Create(new RunbookResource { ProjectId = project.Id, Name = name, Description = description, EnvironmentScope = RunbookEnvironmentScope.All, DefaultGuidedFailureMode = GuidedFailureMode.EnvironmentDefault, RunRetentionPolicy = new RunbookRetentionPeriod { QuantityToKeep = 100 } }); } else { existing.Name = name; existing.Description = description; Instance = repository.Modify(existing); } return(this); }
public RunbookEditor CreateOrModify(ProjectResource project, string name, string description) { var existing = repository.FindByName(project, name); if (existing == null) { Instance = repository.Create(new RunbookResource { ProjectId = project.Id, Name = name, Description = description }); } else { existing.Name = name; existing.Description = description; Instance = repository.Modify(existing); } return(this); }
public async Task <RunbookEditor> CreateOrModify(ProjectResource project, string name, string description) { var existing = await repository.FindByName(project, name).ConfigureAwait(false); if (existing == null) { Instance = await repository.Create(new RunbookResource { ProjectId = project.Id, Name = name, Description = description }).ConfigureAwait(false); } else { existing.Name = name; existing.Description = description; Instance = await repository.Modify(existing).ConfigureAwait(false); } return(this); }