-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathschema_deployment_action_container.go
51 lines (41 loc) · 1.33 KB
/
schema_deployment_action_container.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package octopusdeploy
import (
"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func expandContainer(values interface{}) octopusdeploy.DeploymentActionContainer {
if values == nil {
return octopusdeploy.DeploymentActionContainer{}
}
flattenedValues := values.([]interface{})
if len(flattenedValues) == 0 || flattenedValues[0] == nil {
return octopusdeploy.DeploymentActionContainer{}
}
flattenedMap := flattenedValues[0].(map[string]interface{})
deploymentActionContainer := octopusdeploy.DeploymentActionContainer{}
if feedID := flattenedMap["feed_id"]; feedID != nil {
deploymentActionContainer.FeedID = feedID.(string)
}
if image := flattenedMap["image"]; image != nil {
deploymentActionContainer.Image = image.(string)
}
return deploymentActionContainer
}
func flattenContainer(deploymentActionContainer octopusdeploy.DeploymentActionContainer) []interface{} {
return []interface{}{map[string]interface{}{
"feed_id": deploymentActionContainer.FeedID,
"image": deploymentActionContainer.Image,
}}
}
func getDeploymentActionContainerSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"feed_id": {
Optional: true,
Type: schema.TypeString,
},
"image": {
Optional: true,
Type: schema.TypeString,
},
}
}