Skip to content

Commit

Permalink
Upgrade octopus library version
Browse files Browse the repository at this point in the history
  • Loading branch information
kevjt committed Feb 23, 2024
1 parent d82055d commit 55ef525
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/OctopusDeploy/terraform-provider-octopusdeploy
go 1.20

require (
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.36.2
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.38.1
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20230705105638-f5ef7c07973b
github.com/google/uuid v1.3.0
github.com/gruntwork-io/terratest v0.41.11
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugX
github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg=
github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE=
github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.36.2 h1:ovLCSy+I1mN0nynxNtOkrxUuf4DL2jZc79kkBH6698g=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.36.2/go.mod h1:GZmFu6LmN8Yg0tEoZx3ytk9FnaH+84cWm7u5TdWZC6E=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.38.1 h1:XxaJaWRD+dyTYKkY+Rbw1kZS9G3KkNECvn2Hmk5Bsls=
github.com/OctopusDeploy/go-octopusdeploy/v2 v2.38.1/go.mod h1:GZmFu6LmN8Yg0tEoZx3ytk9FnaH+84cWm7u5TdWZC6E=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20230705105638-f5ef7c07973b h1:XOBPcVHeDUYIpcag0yI8IYKiBL+5LLL8suysvlavQwI=
github.com/OctopusSolutionsEngineering/OctopusTerraformTestFramework v0.0.0-20230705105638-f5ef7c07973b/go.mod h1:E0hYVpZd61fXhzTozkxjiWEy+/yTRxAnr2SIE7k8ZSM=
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ=
Expand Down
23 changes: 12 additions & 11 deletions octopusdeploy/schema_variable_prompt_options.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package octopusdeploy

import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources"
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/variables"
)

func expandPromptedDisplaySettings(values interface{}) *variables.DisplaySettings {
func expandPromptedDisplaySettings(values interface{}) *resources.DisplaySettings {
if values == nil {
return nil
}
Expand All @@ -16,14 +17,14 @@ func expandPromptedDisplaySettings(values interface{}) *variables.DisplaySetting

promptedDisplaySettings := flattenedValues[0].(map[string]interface{})

controlType := variables.ControlType(promptedDisplaySettings["control_type"].(string))
controlType := resources.ControlType(promptedDisplaySettings["control_type"].(string))

var selectOptions []*variables.SelectOption
if controlType == variables.ControlTypeSelect {
var selectOptions []*resources.SelectOption
if controlType == resources.ControlTypeSelect {
selectOptions = expandSelectOptions(promptedDisplaySettings["select_option"])
}

return variables.NewDisplaySettings(controlType, selectOptions)
return resources.NewDisplaySettings(controlType, selectOptions)
}

func expandPromptedVariableSettings(values interface{}) *variables.VariablePromptOptions {
Expand All @@ -45,7 +46,7 @@ func expandPromptedVariableSettings(values interface{}) *variables.VariablePromp
}
}

func expandSelectOptions(values interface{}) []*variables.SelectOption {
func expandSelectOptions(values interface{}) []*resources.SelectOption {
if values == nil {
return nil
}
Expand All @@ -55,11 +56,11 @@ func expandSelectOptions(values interface{}) []*variables.SelectOption {
return nil
}

selectOptions := make([]*variables.SelectOption, len(flattenedValues))
selectOptions := make([]*resources.SelectOption, len(flattenedValues))

for i := 0; i < len(flattenedValues); i++ {
item := flattenedValues[i].(map[string]interface{})
selectOptions[i] = &variables.SelectOption{
selectOptions[i] = &resources.SelectOption{
DisplayName: item["display_name"].(string),
Value: item["value"].(string),
}
Expand All @@ -68,14 +69,14 @@ func expandSelectOptions(values interface{}) []*variables.SelectOption {
return selectOptions
}

func flattenPromptedVariableDisplaySettings(displaySettings *variables.DisplaySettings) []interface{} {
func flattenPromptedVariableDisplaySettings(displaySettings *resources.DisplaySettings) []interface{} {
if displaySettings == nil {
return nil
}

flattenedDisplaySettings := map[string]interface{}{}
flattenedDisplaySettings["control_type"] = displaySettings.ControlType
if displaySettings.ControlType == variables.ControlTypeSelect {
if displaySettings.ControlType == resources.ControlTypeSelect {
flattenedDisplaySettings["select_option"] = flattenSelectOptions(displaySettings.SelectOptions)
}
return []interface{}{flattenedDisplaySettings}
Expand All @@ -99,7 +100,7 @@ func flattenPromptedVariableSettings(variablePromptOptions *variables.VariablePr
return []interface{}{flattenedPrompt}
}

func flattenSelectOptions(selectOptions []*variables.SelectOption) []map[string]interface{} {
func flattenSelectOptions(selectOptions []*resources.SelectOption) []map[string]interface{} {
options := make([]map[string]interface{}, len(selectOptions))
for i := 0; i < len(selectOptions); i++ {
options[i] = map[string]interface{}{
Expand Down

0 comments on commit 55ef525

Please sign in to comment.