-
Notifications
You must be signed in to change notification settings - Fork 65
/
schema_offline_package_drop_destination.go
44 lines (37 loc) · 1.25 KB
/
schema_offline_package_drop_destination.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
package octopusdeploy
import (
"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func expandOfflinePackageDropDestination(values interface{}) octopusdeploy.OfflinePackageDropDestination {
if values == nil {
return octopusdeploy.OfflinePackageDropDestination{}
}
flattenedValues := values.([]interface{})
flattenedEndpoint := flattenedValues[0].(map[string]interface{})
return octopusdeploy.OfflinePackageDropDestination{
DestinationType: flattenedEndpoint["destination_type"].(string),
DropFolderPath: flattenedEndpoint["drop_folder_path"].(string),
}
}
func flattenOfflinePackageDropDestination(offlineDropDestination *octopusdeploy.OfflinePackageDropDestination) []interface{} {
if offlineDropDestination == nil {
return nil
}
return []interface{}{map[string]interface{}{
"destination_type": offlineDropDestination.DestinationType,
"drop_folder_path": offlineDropDestination.DropFolderPath,
}}
}
func getOfflinePackageDropDestinationSchema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"destination_type": {
Optional: true,
Type: schema.TypeString,
},
"drop_folder_path": {
Optional: true,
Type: schema.TypeString,
},
}
}