Skip to content

Commit cf1fc2f

Browse files
committed
feat(vpn-gateway): Fix conn service list
1 parent f878a98 commit cf1fc2f

File tree

3 files changed

+90
-73
lines changed

3 files changed

+90
-73
lines changed

common/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27740,6 +27740,7 @@ func (vpc *VpcV1) GetVPNGatewayServiceConnectionWithContext(ctx context.Context,
2774027740
builder.AddHeader("Accept", "application/json")
2774127741

2774227742
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
27743+
builder.AddQuery("maturity", fmt.Sprint("development"))
2774327744
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
2774427745

2774527746
request, err := builder.Build()
@@ -28416,6 +28417,7 @@ func (vpc *VpcV1) ListVPNGatewayServiceConnectionsWithContext(ctx context.Contex
2841628417
builder.AddHeader("Accept", "application/json")
2841728418

2841828419
builder.AddQuery("version", fmt.Sprint(*vpc.Version))
28420+
builder.AddQuery("maturity", fmt.Sprint("development"))
2841928421
builder.AddQuery("generation", fmt.Sprint(*vpc.Generation))
2842028422
if listVPNGatewayServiceConnectionsOptions.Start != nil {
2842128423
builder.AddQuery("start", fmt.Sprint(*listVPNGatewayServiceConnectionsOptions.Start))

ibm/service/vpc/data_source_ibm_is_vpn_gateway_service_connections.go

Lines changed: 88 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -38,93 +38,102 @@ func DataSourceIBMIsVPNGatewayServiceConnections() *schema.Resource {
3838
Required: true,
3939
Description: "The VPN gateway identifier.",
4040
},
41-
"created_at": {
42-
Type: schema.TypeString,
43-
Computed: true,
44-
Description: "The date and time that this VPN service connection was created.",
45-
},
46-
"creator": {
47-
Type: schema.TypeList,
48-
Computed: true,
49-
Elem: &schema.Resource{
50-
Schema: map[string]*schema.Schema{
51-
"crn": {
52-
Type: schema.TypeString,
53-
Computed: true,
54-
Description: "The CRN for transit gateway resource.",
55-
},
56-
"id": {
57-
Type: schema.TypeString,
58-
Computed: true,
59-
Description: "The unique identifier for transit gateway resource.",
60-
},
61-
"resource_type": {
62-
Type: schema.TypeString,
63-
Computed: true,
64-
Description: "The resource type.",
65-
},
66-
},
67-
},
68-
},
69-
"id": {
70-
Type: schema.TypeString,
71-
Computed: true,
72-
Description: "The unique identifier for this VPN gateway service connection",
73-
},
74-
"lifecycle_reasons": {
41+
isVPNGatewayServiceConnections: {
7542
Type: schema.TypeList,
43+
Description: "Collection of VPN Gateway service connections",
7644
Computed: true,
77-
Description: "The reasons for the current `lifecycle_state` (if any).",
7845
Elem: &schema.Resource{
7946
Schema: map[string]*schema.Schema{
80-
"code": {
47+
"created_at": {
8148
Type: schema.TypeString,
8249
Computed: true,
83-
Description: "A reason code for this lifecycle state:- `internal_error`: internal error (contact IBM support)- `resource_suspended_by_provider`: The resource has been suspended (contact IBM support)The enumerated values for this property may[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.",
50+
Description: "The date and time that this VPN service connection was created.",
8451
},
85-
"message": {
52+
"creator": {
53+
Type: schema.TypeList,
54+
Computed: true,
55+
Elem: &schema.Resource{
56+
Schema: map[string]*schema.Schema{
57+
"crn": {
58+
Type: schema.TypeString,
59+
Computed: true,
60+
Description: "The CRN for transit gateway resource.",
61+
},
62+
"id": {
63+
Type: schema.TypeString,
64+
Computed: true,
65+
Description: "The unique identifier for transit gateway resource.",
66+
},
67+
"resource_type": {
68+
Type: schema.TypeString,
69+
Computed: true,
70+
Description: "The resource type.",
71+
},
72+
},
73+
},
74+
},
75+
"id": {
8676
Type: schema.TypeString,
8777
Computed: true,
88-
Description: "An explanation of the reason for this lifecycle state.",
78+
Description: "The unique identifier for this VPN gateway service connection",
8979
},
90-
"more_info": {
91-
Type: schema.TypeString,
80+
"lifecycle_reasons": {
81+
Type: schema.TypeList,
9282
Computed: true,
93-
Description: "Link to documentation about the reason for this lifecycle state.",
83+
Description: "The reasons for the current `lifecycle_state` (if any).",
84+
Elem: &schema.Resource{
85+
Schema: map[string]*schema.Schema{
86+
"code": {
87+
Type: schema.TypeString,
88+
Computed: true,
89+
Description: "A reason code for this lifecycle state:- `internal_error`: internal error (contact IBM support)- `resource_suspended_by_provider`: The resource has been suspended (contact IBM support)The enumerated values for this property may[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.",
90+
},
91+
"message": {
92+
Type: schema.TypeString,
93+
Computed: true,
94+
Description: "An explanation of the reason for this lifecycle state.",
95+
},
96+
"more_info": {
97+
Type: schema.TypeString,
98+
Computed: true,
99+
Description: "Link to documentation about the reason for this lifecycle state.",
100+
},
101+
},
102+
},
94103
},
95-
},
96-
},
97-
},
98-
"lifecycle_state": {
99-
Type: schema.TypeString,
100-
Computed: true,
101-
Description: "The lifecycle state of the VPN service connection.",
102-
},
103-
"status": {
104-
Type: schema.TypeString,
105-
Computed: true,
106-
Description: "The status of this service connection:- `up`: operating normally- `degraded`: operating with compromised performance- `down`: not operational.",
107-
},
108-
"status_reasons": {
109-
Type: schema.TypeList,
110-
Computed: true,
111-
Description: "The reasons for the current VPN service connection status (if any).",
112-
Elem: &schema.Resource{
113-
Schema: map[string]*schema.Schema{
114-
"code": {
104+
"lifecycle_state": {
115105
Type: schema.TypeString,
116106
Computed: true,
117-
Description: "A snake case string succinctly identifying the status reason. The enumerated values for this property may https://cloud.ibm.com/apidocs/vpc#property-value-expansion in the future.",
107+
Description: "The lifecycle state of the VPN service connection.",
118108
},
119-
"message": {
109+
"status": {
120110
Type: schema.TypeString,
121111
Computed: true,
122-
Description: "An explanation of the reason for this VPN service connection's status.",
112+
Description: "The status of this service connection:- `up`: operating normally- `degraded`: operating with compromised performance- `down`: not operational.",
123113
},
124-
"more_info": {
125-
Type: schema.TypeString,
114+
"status_reasons": {
115+
Type: schema.TypeList,
126116
Computed: true,
127-
Description: "Link to documentation about this status reason.",
117+
Description: "The reasons for the current VPN service connection status (if any).",
118+
Elem: &schema.Resource{
119+
Schema: map[string]*schema.Schema{
120+
"code": {
121+
Type: schema.TypeString,
122+
Computed: true,
123+
Description: "A snake case string succinctly identifying the status reason. The enumerated values for this property may https://cloud.ibm.com/apidocs/vpc#property-value-expansion in the future.",
124+
},
125+
"message": {
126+
Type: schema.TypeString,
127+
Computed: true,
128+
Description: "An explanation of the reason for this VPN service connection's status.",
129+
},
130+
"more_info": {
131+
Type: schema.TypeString,
132+
Computed: true,
133+
Description: "Link to documentation about this status reason.",
134+
},
135+
},
136+
},
128137
},
129138
},
130139
},
@@ -183,7 +192,9 @@ func dataSourceIBMIsVPNGatewayServiceConnectionsRead(ctx context.Context, d *sch
183192
}
184193

185194
d.SetId(dataSourceIBMVPNGatewayServiceConnectionsID(d))
186-
d.Set(isVPNGatewayServiceConnections, vpngatewayServiceConnections)
195+
if err = d.Set(isVPNGatewayServiceConnections, vpngatewayServiceConnections); err != nil {
196+
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting service_connections %s", err), "(Data) ibm_is_vpn_gateway_service_connections", "read", "vpn_gateway-service-connections-set").GetDiag()
197+
}
187198
return nil
188199
}
189200

@@ -224,8 +235,13 @@ func resourceVPNGatewayServiceConnectionFlattenStateReasons(healthReasons []vpcv
224235
return statusReasonsList
225236
}
226237

227-
func resourceVPNGatewayServiceConnectionFlattenCreator(model vpcv1.VPNGatewayServiceConnectionCreatorIntf) (modelMap map[string]interface{}) {
228-
connectionCreatorItem := model.(*vpcv1.VPNGatewayServiceConnectionCreator)
238+
func resourceVPNGatewayServiceConnectionFlattenCreator(model vpcv1.VPNGatewayServiceConnectionCreatorIntf) []map[string]interface{} {
239+
modelMap := make(map[string]interface{})
240+
241+
connectionCreatorItem, ok := model.(*vpcv1.VPNGatewayServiceConnectionCreator)
242+
if !ok || connectionCreatorItem == nil {
243+
return nil
244+
}
229245
if connectionCreatorItem.CRN != nil {
230246
modelMap["crn"] = *connectionCreatorItem.CRN
231247
}
@@ -235,5 +251,5 @@ func resourceVPNGatewayServiceConnectionFlattenCreator(model vpcv1.VPNGatewaySer
235251
if connectionCreatorItem.ResourceType != nil {
236252
modelMap["resource_type"] = *connectionCreatorItem.ResourceType
237253
}
238-
return
254+
return []map[string]interface{}{modelMap}
239255
}

ibm/service/vpc/resource_ibm_is_vpn_gateway_advertised_cidrs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ func ResourceIBMISVPNGatewayAdvertisedCidr() *schema.Resource {
2727
return &schema.Resource{
2828
CreateContext: resourceIBMISVPNGatewayAdvertisedCidrCreate,
2929
ReadContext: resourceIBMISVPNGatewayAdvertisedCidrRead,
30-
UpdateContext: resourceIBMISVPNGatewayAdvertisedCidrCreate,
3130
DeleteContext: resourceIBMISVPNGatewayAdvertisedCidrDelete,
3231

3332
Importer: &schema.ResourceImporter{},

0 commit comments

Comments
 (0)