forked from github/gh-gei
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRevokeMigratorRoleCommandArgs.cs
More file actions
39 lines (33 loc) · 1.23 KB
/
RevokeMigratorRoleCommandArgs.cs
File metadata and controls
39 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using OctoshiftCLI.Extensions;
using OctoshiftCLI.Services;
namespace OctoshiftCLI.Commands.RevokeMigratorRole;
public class RevokeMigratorRoleCommandArgs : CommandArgs
{
public string GithubOrg { get; set; }
public string Actor { get; set; }
public string ActorType { get; set; }
[Secret]
public string GithubPat { get; set; }
public string GhesApiUrl { get; set; }
public string TargetApiUrl { get; set; }
public override void Validate(OctoLogger log)
{
if (GithubOrg.IsUrl())
{
throw new OctoshiftCliException($"The --github-org option expects an organization name, not a URL. Please provide just the organization name (e.g., 'my-org' instead of 'https://github.com/my-org').");
}
ActorType = ActorType?.ToUpper();
if (ActorType is "TEAM" or "USER")
{
log?.LogInformation("Actor type is valid...");
}
else
{
throw new OctoshiftCliException("Actor type must be either TEAM or USER.");
}
if (GhesApiUrl.HasValue() && TargetApiUrl.HasValue())
{
throw new OctoshiftCliException("Only one of --ghes-api-url or --target-api-url can be set at a time.");
}
}
}