OctopusDeploy / go-octopusdeploy

| Public | Go API Client for Octopus Deploy :octopus:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add examples to interact with Project Templates variables

Matroxt opened this issue · comments

Problem

I'm struggling to understand how to interact with project templates variables. The variableService object seems to only expose project variables from what I've been able to see.

This works

	vs, err := client.Variables.GetByName("Projects-1", "project_variable", &octopusdeploy.VariableScope{})
	if err != nil {
		log.Fatalf("error getting variable: %v", err)
	}
	fmt.Printf("%+#v", vs)

This doesn't:

	vs, err := client.Variables.GetByName("Projects-1", "project_template_variable", &octopusdeploy.VariableScope{})
	if err != nil {
		log.Fatalf("error getting variable: %v", err)
	}
	fmt.Printf("%+#v", vs)

If another struct can expose those, that's fine, but it's not obvious which one.

Solutions

  • Provide a example how how to use it in the repository's examples directory

I tried looking in the Octopus Terraform provider repo, but haven't been able to find something useful regarding this issue.

Screen Shot 2022-01-20 at 6 04 36 PM

UPDATE: I managed to do what I wanted with the client.Tenants.GetVariables() and client.Tenants.UpdateVariables() methods.

Was a bit hard to find because they're not called Project Templates in the API, but I guess it make sense to scope them with the tenants.