/
connection_config.go
107 lines (101 loc) · 2.79 KB
/
connection_config.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
package openstack
import (
"github.com/turbot/steampipe-plugin-sdk/v5/plugin"
"github.com/turbot/steampipe-plugin-sdk/v5/plugin/schema"
)
type openstackConfig struct {
EndpointUrl *string `cty:"endpoint_url"`
UserID *string `cty:"userid"`
Username *string `cty:"username"`
Password *string `cty:"password"`
Region *string `cty:"region"`
ProjectID *string `cty:"project_id"`
ProjectName *string `cty:"project_name"`
DomainID *string `cty:"domain_id"`
DomainName *string `cty:"domain_name"`
AccessToken *string `cty:"access_token"`
AppCredentialID *string `cty:"app_credential_id"`
AppCredentialSecret *string `cty:"app_credential_secret"`
AllowReauth *bool `cty:"allow_reauth"`
TraceLevel *string `cty:"trace_level"`
IdentityV3Microversion *string `cty:"identity_v3_microversion"`
ComputeV2Microversion *string `cty:"compute_v2_microversion"`
NetworkV2Microversion *string `cty:"network_v2_microversion"`
BlockStorageV3Microversion *string `cty:"blockstorage_v3_microversion"`
ImageServiceV2Microversion *string `cty:"imageservice_v2_microversion"`
// TODO: check
// AppCredentialName *string `cty:"app_credential_name"`
}
var ConfigSchema = map[string]*schema.Attribute{
"endpoint_url": {
Type: schema.TypeString,
},
"userid": {
Type: schema.TypeString,
},
"username": {
Type: schema.TypeString,
},
"password": {
Type: schema.TypeString,
},
"region": {
Type: schema.TypeString,
},
"project_id": {
Type: schema.TypeString,
},
"project_name": {
Type: schema.TypeString,
},
"domain_id": {
Type: schema.TypeString,
},
"domain_name": {
Type: schema.TypeString,
},
"access_token": {
Type: schema.TypeString,
},
"app_credential_id": {
Type: schema.TypeString,
},
// "app_credential_name": {
// Type: schema.TypeString,
// },
"app_credential_secret": {
Type: schema.TypeString,
},
"allow_reauth": {
Type: schema.TypeBool,
},
"trace_level": {
Type: schema.TypeString,
},
"identity_v3_microversion": {
Type: schema.TypeString,
},
"compute_v2_microversion": {
Type: schema.TypeString,
},
"network_v2_microversion": {
Type: schema.TypeString,
},
"blockstorage_v3_microversion": {
Type: schema.TypeString,
},
"imageservice_v2_microversion": {
Type: schema.TypeString,
},
}
func ConfigInstance() interface{} {
return &openstackConfig{}
}
// GetConfig :: retrieve and cast connection config from query data
func GetConfig(connection *plugin.Connection) openstackConfig {
if connection == nil || connection.Config == nil {
return openstackConfig{}
}
config, _ := connection.Config.(openstackConfig)
return config
}