Skip to content

Commit

Permalink
migrated vpc-go-sdk to 0.49.1 version
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ibm authored and hkantare committed Mar 22, 2024
1 parent dc2f51a commit d85cd00
Show file tree
Hide file tree
Showing 11 changed files with 833 additions and 225 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/IBM/schematics-go-sdk v0.2.3
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4
github.com/IBM/vpc-beta-go-sdk v0.6.0
github.com/IBM/vpc-go-sdk v0.48.0
github.com/IBM/vpc-go-sdk v0.49.1
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2
github.com/akamai/AkamaiOPEN-edgegrid-golang/v5 v5.0.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4 h1:xa9e+POVqaXxXHXkSMCOVAbKdUNEu
github.com/IBM/secrets-manager-go-sdk/v2 v2.0.4/go.mod h1:5gq8D8uWOIbqOm1uztay6lpOysgJaxxEsaVZLWGWb40=
github.com/IBM/vpc-beta-go-sdk v0.6.0 h1:wfM3AcW3zOM3xsRtZ+EA6+sESlGUjQ6Yf4n5QQyz4uc=
github.com/IBM/vpc-beta-go-sdk v0.6.0/go.mod h1:fzHDAQIqH/5yJmYsKodKHLcqxMDT+yfH6vZjdiw8CQA=
github.com/IBM/vpc-go-sdk v0.48.0 h1:4yeSxVX9mizsIW2F0rsVI47rZoNKBrZ1QK9RwwRas9Q=
github.com/IBM/vpc-go-sdk v0.48.0/go.mod h1:FDJpiokOmaYG2hNYDfqKVxUPe8mm/dPi3mdz8Zt4o/Q=
github.com/IBM/vpc-go-sdk v0.49.1 h1:VIkZ8iJMBHqBulUXcPtN0ifxsa0xwlBtaLslU2V9HsY=
github.com/IBM/vpc-go-sdk v0.49.1/go.mod h1:iBg9UJY1y/XpkweyP6YH7G6guzKPV8BYDoBMTdPupH4=
github.com/Jeffail/gabs v1.1.1 h1:V0uzR08Hj22EX8+8QMhyI9sX2hwRu+/RJhJUmnwda/E=
github.com/Jeffail/gabs v1.1.1/go.mod h1:6xMvQMK4k33lb7GUUpaAPh6nKMmemQeg5d4gn7/bOXc=
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ func dataSourceIBMIsSnapshotConsistencyGroupResourceGroupReferenceToMap(model *v
return modelMap, nil
}

func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotConsistencyGroupSnapshotsItem) (map[string]interface{}, error) {
func dataSourceIBMIsSnapshotConsistencyGroupSnapshotConsistencyGroupSnapshotsItemToMap(model *vpcv1.SnapshotReference) (map[string]interface{}, error) {
modelMap := make(map[string]interface{})
modelMap["crn"] = model.CRN
if model.Deleted != nil {
Expand Down
388 changes: 313 additions & 75 deletions ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection.go

Large diffs are not rendered by default.

89 changes: 41 additions & 48 deletions ibm/service/vpc/data_source_ibm_is_vpn_gateway_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "name"),
Expand All @@ -51,8 +49,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example1", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example1", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example1", "name"),
Expand All @@ -71,8 +67,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example2", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example2", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example2", "name"),
Expand All @@ -91,8 +85,6 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.action"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.interval"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "dead_peer_detection.0.timeout"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.public_ip_address"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example", "tunnels.0.status"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example3", "href"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example3", "mode"),
resource.TestCheckResourceAttrSet("data.ibm_is_vpn_gateway_connection.example3", "name"),
Expand All @@ -108,45 +100,46 @@ func TestAccIBMIsVPNGatewayConnectionDataSourceBasic(t *testing.T) {

func testAccCheckIBMIsVPNGatewayConnectionDataSourceConfigBasic(vpc, subnet, vpngwname, name string) string {
return fmt.Sprintf(`
resource "ibm_is_vpc" "example" {
name = "%s"
}
resource "ibm_is_subnet" "example" {
name = "%s"
vpc = "${ibm_is_vpc.example.id}"
zone = "%s"
ipv4_cidr_block = "%s"
}
resource "ibm_is_vpn_gateway" "example" {
name = "%s"
subnet = "${ibm_is_subnet.example.id}"
}
resource "ibm_is_vpn_gateway_connection" "example" {
name = "%s"
vpn_gateway = "${ibm_is_vpn_gateway.example.id}"
peer_address = "1.2.3.4"
local_cidrs = [ibm_is_subnet.example.ipv4_cidr_block]
preshared_key = "VPNDemoPassword"
}
data "ibm_is_vpn_gateway_connection" "example" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example1" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
data "ibm_is_vpn_gateway_connection" "example2" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example3" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
resource "ibm_is_vpc" "example" {
name = "%s"
}
resource "ibm_is_subnet" "example" {
name = "%s"
vpc = ibm_is_vpc.example.id
zone = "%s"
ipv4_cidr_block = "%s"
}
resource "ibm_is_vpn_gateway" "example" {
name = "%s"
subnet = ibm_is_subnet.example.id
mode = "policy"
}
resource "ibm_is_vpn_gateway_connection" "example" {
name = "%s"
vpn_gateway = ibm_is_vpn_gateway.example.id
peer_address = "1.2.3.4"
peer_cidrs = [ibm_is_subnet.example.ipv4_cidr_block]
local_cidrs = [ibm_is_subnet.example.ipv4_cidr_block]
preshared_key = "VPNDemoPassword"
}
data "ibm_is_vpn_gateway_connection" "example" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example1" {
vpn_gateway = ibm_is_vpn_gateway.example.id
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
data "ibm_is_vpn_gateway_connection" "example2" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection = ibm_is_vpn_gateway_connection.example.gateway_connection
}
data "ibm_is_vpn_gateway_connection" "example3" {
vpn_gateway_name = ibm_is_vpn_gateway.example.name
vpn_gateway_connection_name = ibm_is_vpn_gateway_connection.example.name
}
`, vpc, subnet, acc.ISZoneName, acc.ISCIDR, vpngwname, name)
}
186 changes: 148 additions & 38 deletions ibm/service/vpc/data_source_ibm_is_vpn_gateway_connections.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,51 +197,161 @@ func dataSourceIBMVPNGatewayConnectionsRead(d *schema.ResourceData, meta interfa
return fmt.Errorf("[ERROR] Error reading list of VPN Gateway Connections:%s\n%s", err, detail)
}
vpngatewayconnections := make([]map[string]interface{}, 0)
for _, instance := range availableVPNGatewayConnections.Connections {
for _, vpnGatewayConnectionIntf := range availableVPNGatewayConnections.Connections {
gatewayconnection := map[string]interface{}{}
data := instance.(*vpcv1.VPNGatewayConnection)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID
if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionPolicyMode)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
if data.LocalCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs)
}
if data.PeerCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs)
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
if data.LocalCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs)
}
if data.PeerCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs)
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
} else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteMode)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
}
} else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnectionRouteModeVPNGatewayConnectionStaticRouteMode)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
}
} else if _, ok := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection); ok {
data := vpnGatewayConnectionIntf.(*vpcv1.VPNGatewayConnection)
gatewayconnection[isVPNGatewayConnectionAdminAuthenticationmode] = *data.AuthenticationMode
gatewayconnection[isVPNGatewayConnectionCreatedat] = data.CreatedAt.String()
gatewayconnection[isVPNGatewayConnectionAdminStateup] = *data.AdminStateUp
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionAction] = *data.DeadPeerDetection.Action
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionInterval] = *data.DeadPeerDetection.Interval
gatewayconnection[isVPNGatewayConnectionDeadPeerDetectionTimeout] = *data.DeadPeerDetection.Timeout
gatewayconnection[isVPNGatewayConnectionID] = *data.ID

if data.IkePolicy != nil {
gatewayconnection[isVPNGatewayConnectionIKEPolicy] = *data.IkePolicy.ID
}
if data.IpsecPolicy != nil {
gatewayconnection[isVPNGatewayConnectionIPSECPolicy] = *data.IpsecPolicy.ID
}
if data.LocalCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionLocalCIDRS] = flex.FlattenStringList(data.LocalCIDRs)
}
if data.PeerCIDRs != nil {
gatewayconnection[isVPNGatewayConnectionPeerCIDRS] = flex.FlattenStringList(data.PeerCIDRs)
}
gatewayconnection[isVPNGatewayConnectionMode] = *data.Mode
gatewayconnection[isVPNGatewayConnectionName] = *data.Name
gatewayconnection[isVPNGatewayConnectionPeerAddress] = *data.PeerAddress
gatewayconnection[isVPNGatewayConnectionResourcetype] = *data.ResourceType
gatewayconnection[isVPNGatewayConnectionStatus] = *data.Status
gatewayconnection[isVPNGatewayConnectionStatusreasons] = resourceVPNGatewayConnectionFlattenLifecycleReasons(data.StatusReasons)
//if data.Tunnels != nil {
if len(data.Tunnels) > 0 {
vpcTunnelsList := make([]map[string]interface{}, 0)
for _, vpcTunnel := range data.Tunnels {
currentTunnel := map[string]interface{}{}
if vpcTunnel.PublicIP != nil {
if vpcTunnel.PublicIP != nil {
currentTunnel["address"] = *vpcTunnel.PublicIP.Address
}
if vpcTunnel.Status != nil {
currentTunnel["status"] = *vpcTunnel.Status
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
vpcTunnelsList = append(vpcTunnelsList, currentTunnel)
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
}
gatewayconnection[isVPNGatewayConnectionTunnels] = vpcTunnelsList
} else {
return fmt.Errorf("[ERROR] Unrecognized vpcv1.vpnGatewayConnectionIntf subtype encountered")
}

vpngatewayconnections = append(vpngatewayconnections, gatewayconnection)
Expand Down
Loading

0 comments on commit d85cd00

Please sign in to comment.