Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions examples/ServiceAccountMaintenance/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private static void Main(string[] args)
private static void Setup()
{
ServiceAccountIds = new List<long>();
var perm = new Permission
var permProject = new Permission
{
Parts = {new RepeatedField<string> {"prj", ProjectName, "*"}},
Verbs =
Expand All @@ -123,6 +123,18 @@ private static void Setup()
}
}
};

var permServices = new Permission
{
Parts = {new RepeatedField<string> {"srv", "*"}},
Verbs =
{
new RepeatedField<Permission.Types.Verb>
{
Permission.Types.Verb.Read
}
}
};

Console.WriteLine("Setting up for the scenario by creating new service accounts...");
for (var i = 0; i < NumberOfServiceAccountsToCreate; i++)
Expand All @@ -131,7 +143,7 @@ private static void Setup()
{
Name = ServiceAccountName,
ProjectName = ProjectName,
Permissions = {new RepeatedField<Permission> {perm}},
Permissions = {new RepeatedField<Permission> {permProject, permServices}},
Lifetime = Duration.FromTimeSpan(new TimeSpan(1, 0, 0, 0)) // Let this service account live for one day
});
ServiceAccountIds.Add(resp.Id);
Expand Down