@@ -597,13 +597,16 @@ func TestSubscription_ListVPCPeering(t *testing.T) {
597
597
"response": {
598
598
"resourceId" : 12356,
599
599
"resource" : {
600
- "peerings" : [ {
601
- "vpcPeeringId" : 10,
602
- "awsAccountId" : "4291",
603
- "vpcUid" : "vpc-deadbeef",
604
- "vpcCidr" : "10.0.0.0/24",
605
- "status" : "done"
606
- } ]
600
+ "peerings" : [
601
+ {
602
+ "vpcPeeringId": 10,
603
+ "awsAccountId": "4291",
604
+ "vpcUid": "vpc-deadbeef",
605
+ "vpcCidr": "10.0.0.0/24",
606
+ "awsPeeringUid": "pcx-0123456789",
607
+ "status": "done"
608
+ }
609
+ ]
607
610
}
608
611
},
609
612
"_links": {
@@ -626,11 +629,75 @@ func TestSubscription_ListVPCPeering(t *testing.T) {
626
629
AWSAccountID : redis .String ("4291" ),
627
630
VPCId : redis .String ("vpc-deadbeef" ),
628
631
VPCCidr : redis .String ("10.0.0.0/24" ),
632
+ AWSPeeringID : redis .String ("pcx-0123456789" ),
629
633
Status : redis .String ("done" ),
630
634
},
631
635
}, actual )
632
636
}
633
637
638
+ func TestSubscription_ListVPCPeering_gcp (t * testing.T ) {
639
+ s := httptest .NewServer (testServer ("apiKey" , "secret" , getRequest (t , "/subscriptions/12356/peerings" , `{
640
+ "taskId": "task",
641
+ "commandType": "peeringListRequest",
642
+ "status": "received",
643
+ "description": "Task request received and is being queued for processing.",
644
+ "timestamp": "2020-11-02T09:05:34.3Z",
645
+ "_links": {
646
+ "task": {
647
+ "href": "https://example.org",
648
+ "title": "getTaskStatusUpdates",
649
+ "type": "GET"
650
+ }
651
+ }
652
+ }` ), getRequest (t , "/tasks/task" , `{
653
+ "taskId": "task",
654
+ "commandType": "vpcPeeringGetRequest",
655
+ "status": "processing-completed",
656
+ "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.",
657
+ "timestamp": "2020-12-01T14:56:09.204Z",
658
+ "response": {
659
+ "resourceId": 12356,
660
+ "resource": {
661
+ "peerings": [
662
+ {
663
+ "vpcPeeringId": 11,
664
+ "projectUid": "cloud-api-123456",
665
+ "networkName": "cloud-api-vpc-peering-test",
666
+ "redisProjectUid": "v00d1c1f22233333f-tp",
667
+ "redisNetworkName": "c12345-us-east1-2-rlrcp",
668
+ "cloudPeeringId": "redislabs-peering-f123abc4-d56",
669
+ "status": "inactive"
670
+ }
671
+ ]
672
+ }
673
+ },
674
+ "_links": {
675
+ "self": {
676
+ "href": "https://example.com",
677
+ "type": "GET"
678
+ }
679
+ }
680
+ }` )))
681
+
682
+ subject , err := clientFromTestServer (s , "apiKey" , "secret" )
683
+ require .NoError (t , err )
684
+
685
+ actual , err := subject .Subscription .ListVPCPeering (context .TODO (), 12356 )
686
+ require .NoError (t , err )
687
+
688
+ assert .ElementsMatch (t , []* subscriptions.VPCPeering {
689
+ {
690
+ ID : redis .Int (11 ),
691
+ Status : redis .String ("inactive" ),
692
+ GCPProjectUID : redis .String ("cloud-api-123456" ),
693
+ NetworkName : redis .String ("cloud-api-vpc-peering-test" ),
694
+ RedisProjectUID : redis .String ("v00d1c1f22233333f-tp" ),
695
+ RedisNetworkName : redis .String ("c12345-us-east1-2-rlrcp" ),
696
+ CloudPeeringID : redis .String ("redislabs-peering-f123abc4-d56" ),
697
+ },
698
+ }, actual )
699
+ }
700
+
634
701
func TestSubscription_CreateVPCPeering (t * testing.T ) {
635
702
expected := 1235
636
703
s := httptest .NewServer (testServer ("key" , "secret" , postRequest (t , "/subscriptions/42/peerings" , `{
0 commit comments