Is there a way to get all of the variables using the Octopus.Client api?
We have a lot stored in Octopus and I want to compare the data in a spreadsheet to another document. I’m trying to write a simple utility to extract this info into a CSV.
Right now I have:
var server = “{server}”;
//var apiKey = “{key}”;
var endpoint = new OctopusServerEndpoint(server);
var repo = new OctopusRepository(endpoint);
repo.Users.SignIn(new LoginCommand() {Username = “{user}”, Password = “{password}”});
List<LibraryVariableSetResource> library = repo.LibraryVariableSets.FindAll();
//The signature of the VariableSets.Get() requires an array of string ids
//I assume this to be the VariableSetId property on each LibraryVariableSetResource object returned from the call above
//This keeps throwing a now found exception
var variables = repo.VariableSets.Get(library.Select(x => x.VariableSetId).ToArray());
var data = JsonConvert.SerializeObject(library);