Created
January 29, 2019 13:30
-
-
Save janv8000/96a07e89132b42d7b18e8310846df435 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string server = "http://srvoctopus"; | |
const string apiKey = "API-keyhier"; | |
var endpoint = new OctopusServerEndpoint(server, apiKey); | |
using (var client = await OctopusAsyncClient.Create(endpoint)) | |
{ | |
var repository = client.CreateRepository(); | |
var allProjects = await repository.Projects.GetAll(); | |
var variableCombinations = allProjects.SelectMany( | |
project => repository.VariableSets.Get(project.VariableSetId).Result.Variables, | |
(project, variable) => new | |
{ | |
ProjectName = project.Name, | |
VariableValue = new { variable.Name, variable.Value, variable.IsSensitive, variable.Scope } | |
}); | |
File.WriteAllText("output.json", JsonConvert.SerializeObject(variableCombinations)); | |
Process.Start("output.json"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment