diff --git a/test/unit/transit-gateway-apis.v1.test.js b/test/unit/transit-gateway-apis.v1.test.js index a01e4b3..2342949 100644 --- a/test/unit/transit-gateway-apis.v1.test.js +++ b/test/unit/transit-gateway-apis.v1.test.js @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2025. + * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,9 +150,11 @@ describe('TransitGatewayApisV1', () => { // Construct the params object for operation listTransitGateways const limit = 50; const start = 'testString'; + const redundancyGroup = 'testString'; const listTransitGatewaysParams = { limit, start, + redundancyGroup, }; const listTransitGatewaysResult = transitGatewayApisService.listTransitGateways(listTransitGatewaysParams); @@ -172,6 +174,7 @@ describe('TransitGatewayApisV1', () => { expect(mockRequestOptions.qs.version).toEqual(transitGatewayApisServiceOptions.version); expect(mockRequestOptions.qs.limit).toEqual(limit); expect(mockRequestOptions.qs.start).toEqual(start); + expect(mockRequestOptions.qs.redundancy_group).toEqual(redundancyGroup); } test('should pass the right params to createRequest with enable and disable retries', () => { @@ -215,9 +218,9 @@ describe('TransitGatewayApisV1', () => { const serviceUrl = transitGatewayApisServiceOptions.url; const path = '/transit_gateways'; const mockPagerResponse1 = - '{"next":{"start":"1"},"transit_gateways":[{"connection_count":5,"connection_needs_attention":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","global":true,"gre_enhanced_route_propagation":true,"id":"0a06fb9b-820f-4c44-8a31-77f1f0806d28","location":"us-south","name":"my-transit-gateway-in-TransitGateway","resource_group":{"href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8","id":"56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}'; + '{"next":{"start":"1"},"transit_gateways":[{"connection_count":5,"connection_needs_attention":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","global":true,"gre_enhanced_route_propagation":true,"id":"0a06fb9b-820f-4c44-8a31-77f1f0806d28","location":"us-south","name":"my-transit-gateway-in-TransitGateway","redundancy_group":"rg-1","redundancy_group_id":"ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","resource_group":{"href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8","id":"56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}'; const mockPagerResponse2 = - '{"transit_gateways":[{"connection_count":5,"connection_needs_attention":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","global":true,"gre_enhanced_route_propagation":true,"id":"0a06fb9b-820f-4c44-8a31-77f1f0806d28","location":"us-south","name":"my-transit-gateway-in-TransitGateway","resource_group":{"href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8","id":"56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}'; + '{"transit_gateways":[{"connection_count":5,"connection_needs_attention":true,"created_at":"2019-01-01T12:00:00.000Z","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","global":true,"gre_enhanced_route_propagation":true,"id":"0a06fb9b-820f-4c44-8a31-77f1f0806d28","location":"us-south","name":"my-transit-gateway-in-TransitGateway","redundancy_group":"rg-1","redundancy_group_id":"ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","resource_group":{"href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8","id":"56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}'; beforeEach(() => { unmock_createRequest(); @@ -236,6 +239,7 @@ describe('TransitGatewayApisV1', () => { test('getNext()', async () => { const params = { limit: 10, + redundancyGroup: 'testString', }; const allResults = []; const pager = new TransitGatewayApisV1.TransitGatewaysPager(transitGatewayApisService, params); @@ -251,6 +255,7 @@ describe('TransitGatewayApisV1', () => { test('getAll()', async () => { const params = { limit: 10, + redundancyGroup: 'testString', }; const pager = new TransitGatewayApisV1.TransitGatewaysPager(transitGatewayApisService, params); const allResults = await pager.getAll(); @@ -275,12 +280,14 @@ describe('TransitGatewayApisV1', () => { const name = 'my-transit-gateway-in-TransitGateway'; const global = true; const greEnhancedRoutePropagation = true; + const redundancyGroup = 'rg-1'; const resourceGroup = resourceGroupIdentityModel; const createTransitGatewayParams = { location, name, global, greEnhancedRoutePropagation, + redundancyGroup, resourceGroup, }; @@ -302,6 +309,7 @@ describe('TransitGatewayApisV1', () => { expect(mockRequestOptions.body.name).toEqual(name); expect(mockRequestOptions.body.global).toEqual(global); expect(mockRequestOptions.body.gre_enhanced_route_propagation).toEqual(greEnhancedRoutePropagation); + expect(mockRequestOptions.body.redundancy_group).toEqual(redundancyGroup); expect(mockRequestOptions.body.resource_group).toEqual(resourceGroup); expect(mockRequestOptions.qs.version).toEqual(transitGatewayApisServiceOptions.version); } @@ -544,11 +552,13 @@ describe('TransitGatewayApisV1', () => { const global = true; const greEnhancedRoutePropagation = true; const name = 'my-resource'; + const redundancyGroup = 'rg-1'; const updateTransitGatewayParams = { id, global, greEnhancedRoutePropagation, name, + redundancyGroup, }; const updateTransitGatewayResult = transitGatewayApisService.updateTransitGateway(updateTransitGatewayParams); @@ -568,6 +578,7 @@ describe('TransitGatewayApisV1', () => { expect(mockRequestOptions.body.global).toEqual(global); expect(mockRequestOptions.body.gre_enhanced_route_propagation).toEqual(greEnhancedRoutePropagation); expect(mockRequestOptions.body.name).toEqual(name); + expect(mockRequestOptions.body.redundancy_group).toEqual(redundancyGroup); expect(mockRequestOptions.qs.version).toEqual(transitGatewayApisServiceOptions.version); expect(mockRequestOptions.path.id).toEqual(id); } @@ -707,9 +718,9 @@ describe('TransitGatewayApisV1', () => { const serviceUrl = transitGatewayApisServiceOptions.url; const path = '/connections'; const mockPagerResponse1 = - '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"network_account_id","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; + '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","cidr":"198.19.174.0/23","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"network_account_id","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":1,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; const mockPagerResponse2 = - '{"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"network_account_id","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; + '{"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","cidr":"198.19.174.0/23","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"network_account_id","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":1,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; beforeEach(() => { unmock_createRequest(); @@ -853,9 +864,9 @@ describe('TransitGatewayApisV1', () => { const serviceUrl = transitGatewayApisServiceOptions.url; const path = '/transit_gateways/testString/connections'; const mockPagerResponse1 = - '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"192.168.0.0/24","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_BWTN_SJ_DL","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; + '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"198.19.174.0/23","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_BWTN_SJ_DL","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":1,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; const mockPagerResponse2 = - '{"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"192.168.0.0/24","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_BWTN_SJ_DL","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; + '{"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"198.19.174.0/23","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_BWTN_SJ_DL","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":1,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}'; beforeEach(() => { unmock_createRequest(); @@ -936,7 +947,7 @@ describe('TransitGatewayApisV1', () => { const networkType = 'vpc'; const baseConnectionId = '975f58c1-afe7-469a-9727-7f3d720f2d32'; const baseNetworkType = 'classic'; - const cidr = '192.168.0.0/24'; + const cidr = '198.19.174.0/23'; const localGatewayIp = '192.168.100.1'; const localTunnelIp = '192.168.129.2'; const name = 'Transit_Service_BWTN_SJ_DL'; @@ -2936,4 +2947,242 @@ describe('TransitGatewayApisV1', () => { }); }); }); + + describe('listRedundancyGroups', () => { + describe('positive tests', () => { + function __listRedundancyGroupsTest() { + // Construct the params object for operation listRedundancyGroups + const name = 'testString'; + const listRedundancyGroupsParams = { + name, + }; + + const listRedundancyGroupsResult = transitGatewayApisService.listRedundancyGroups(listRedundancyGroupsParams); + + // all methods should return a Promise + expectToBePromise(listRedundancyGroupsResult); + + // assert that create request was called + expect(createRequestMock).toHaveBeenCalledTimes(1); + + const mockRequestOptions = getOptions(createRequestMock); + + checkUrlAndMethod(mockRequestOptions, '/redundancy_groups', 'GET'); + const expectedAccept = 'application/json'; + const expectedContentType = undefined; + checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); + expect(mockRequestOptions.qs.version).toEqual(transitGatewayApisServiceOptions.version); + expect(mockRequestOptions.qs.name).toEqual(name); + } + + test('should pass the right params to createRequest with enable and disable retries', () => { + // baseline test + __listRedundancyGroupsTest(); + + // enable retries and test again + createRequestMock.mockClear(); + transitGatewayApisService.enableRetries(); + __listRedundancyGroupsTest(); + + // disable retries and test again + createRequestMock.mockClear(); + transitGatewayApisService.disableRetries(); + __listRedundancyGroupsTest(); + }); + + test('should prioritize user-given headers', () => { + // parameters + const userAccept = 'fake/accept'; + const userContentType = 'fake/contentType'; + const listRedundancyGroupsParams = { + headers: { + Accept: userAccept, + 'Content-Type': userContentType, + }, + }; + + transitGatewayApisService.listRedundancyGroups(listRedundancyGroupsParams); + checkMediaHeaders(createRequestMock, userAccept, userContentType); + }); + + test('should not have any problems when no parameters are passed in', () => { + // invoke the method with no parameters + transitGatewayApisService.listRedundancyGroups({}); + checkForSuccessfulExecution(createRequestMock); + }); + }); + }); + + describe('getRedundancyGroup', () => { + describe('positive tests', () => { + function __getRedundancyGroupTest() { + // Construct the params object for operation getRedundancyGroup + const id = 'testString'; + const getRedundancyGroupParams = { + id, + }; + + const getRedundancyGroupResult = transitGatewayApisService.getRedundancyGroup(getRedundancyGroupParams); + + // all methods should return a Promise + expectToBePromise(getRedundancyGroupResult); + + // assert that create request was called + expect(createRequestMock).toHaveBeenCalledTimes(1); + + const mockRequestOptions = getOptions(createRequestMock); + + checkUrlAndMethod(mockRequestOptions, '/redundancy_groups/{id}', 'GET'); + const expectedAccept = 'application/json'; + const expectedContentType = undefined; + checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); + expect(mockRequestOptions.qs.version).toEqual(transitGatewayApisServiceOptions.version); + expect(mockRequestOptions.path.id).toEqual(id); + } + + test('should pass the right params to createRequest with enable and disable retries', () => { + // baseline test + __getRedundancyGroupTest(); + + // enable retries and test again + createRequestMock.mockClear(); + transitGatewayApisService.enableRetries(); + __getRedundancyGroupTest(); + + // disable retries and test again + createRequestMock.mockClear(); + transitGatewayApisService.disableRetries(); + __getRedundancyGroupTest(); + }); + + test('should prioritize user-given headers', () => { + // parameters + const id = 'testString'; + const userAccept = 'fake/accept'; + const userContentType = 'fake/contentType'; + const getRedundancyGroupParams = { + id, + headers: { + Accept: userAccept, + 'Content-Type': userContentType, + }, + }; + + transitGatewayApisService.getRedundancyGroup(getRedundancyGroupParams); + checkMediaHeaders(createRequestMock, userAccept, userContentType); + }); + }); + + describe('negative tests', () => { + test('should enforce required parameters', async () => { + let err; + try { + await transitGatewayApisService.getRedundancyGroup({}); + } catch (e) { + err = e; + } + + expect(err.message).toMatch(/Missing required parameters/); + }); + + test('should reject promise when required params are not given', async () => { + let err; + try { + await transitGatewayApisService.getRedundancyGroup(); + } catch (e) { + err = e; + } + + expect(err.message).toMatch(/Missing required parameters/); + }); + }); + }); + + describe('updateRedundancyGroup', () => { + describe('positive tests', () => { + function __updateRedundancyGroupTest() { + // Construct the params object for operation updateRedundancyGroup + const id = 'testString'; + const name = 'new-rg-name'; + const updateRedundancyGroupParams = { + id, + name, + }; + + const updateRedundancyGroupResult = transitGatewayApisService.updateRedundancyGroup(updateRedundancyGroupParams); + + // all methods should return a Promise + expectToBePromise(updateRedundancyGroupResult); + + // assert that create request was called + expect(createRequestMock).toHaveBeenCalledTimes(1); + + const mockRequestOptions = getOptions(createRequestMock); + + checkUrlAndMethod(mockRequestOptions, '/redundancy_groups/{id}', 'PATCH'); + const expectedAccept = 'application/json'; + const expectedContentType = 'application/merge-patch+json'; + checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType); + expect(mockRequestOptions.body.name).toEqual(name); + expect(mockRequestOptions.qs.version).toEqual(transitGatewayApisServiceOptions.version); + expect(mockRequestOptions.path.id).toEqual(id); + } + + test('should pass the right params to createRequest with enable and disable retries', () => { + // baseline test + __updateRedundancyGroupTest(); + + // enable retries and test again + createRequestMock.mockClear(); + transitGatewayApisService.enableRetries(); + __updateRedundancyGroupTest(); + + // disable retries and test again + createRequestMock.mockClear(); + transitGatewayApisService.disableRetries(); + __updateRedundancyGroupTest(); + }); + + test('should prioritize user-given headers', () => { + // parameters + const id = 'testString'; + const userAccept = 'fake/accept'; + const userContentType = 'fake/contentType'; + const updateRedundancyGroupParams = { + id, + headers: { + Accept: userAccept, + 'Content-Type': userContentType, + }, + }; + + transitGatewayApisService.updateRedundancyGroup(updateRedundancyGroupParams); + checkMediaHeaders(createRequestMock, userAccept, userContentType); + }); + }); + + describe('negative tests', () => { + test('should enforce required parameters', async () => { + let err; + try { + await transitGatewayApisService.updateRedundancyGroup({}); + } catch (e) { + err = e; + } + + expect(err.message).toMatch(/Missing required parameters/); + }); + + test('should reject promise when required params are not given', async () => { + let err; + try { + await transitGatewayApisService.updateRedundancyGroup(); + } catch (e) { + err = e; + } + + expect(err.message).toMatch(/Missing required parameters/); + }); + }); + }); }); diff --git a/transit-gateway-apis/v1.ts b/transit-gateway-apis/v1.ts index e234932..0f0b7fb 100644 --- a/transit-gateway-apis/v1.ts +++ b/transit-gateway-apis/v1.ts @@ -1,5 +1,5 @@ /** - * (C) Copyright IBM Corp. 2025. + * (C) Copyright IBM Corp. 2026. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -116,11 +116,17 @@ class TransitGatewayApisV1 extends BaseService { /** * Retrieves all Transit Gateways. * - * List all Transit Gateways in account the caller is authorized to view. + * List all Transit Gateways in the account the caller is authorized to view. Use the `limit` (integer, 1–100, default + * 50) and `start` (string token) parameters to page through results. Optionally filter by `redundancy_group` name. + * Each `TransitGateway` in the response includes: `id`, `name`, `crn`, `location`, + * `status` (pending, available, deleting, deleted, failed), `global` (boolean), + * `created_at`, `updated_at`, `resource_group`, and optionally `redundancy_group`, + * `redundancy_group_id`, `gre_enhanced_route_propagation`, and `connection_needs_attention`. * * @param {Object} [params] - The parameters to send to the service. * @param {number} [params.limit] - The maximum number of resources to return per page. * @param {string} [params.start] - A server supplied token determining which resource to start the page on. + * @param {string} [params.redundancyGroup] - Filter the list of transit gateways by redundancy group name. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ @@ -129,7 +135,7 @@ class TransitGatewayApisV1 extends BaseService { ): Promise> { const _params = { ...params }; const _requiredParams = []; - const _validParams = ['limit', 'start', 'signal', 'headers']; + const _validParams = ['limit', 'start', 'redundancyGroup', 'signal', 'headers']; const _validationErrors = validateParams(_params, _requiredParams, _validParams); if (_validationErrors) { return Promise.reject(_validationErrors); @@ -139,6 +145,7 @@ class TransitGatewayApisV1 extends BaseService { 'version': this.version, 'limit': _params.limit, 'start': _params.start, + 'redundancy_group': _params.redundancyGroup, }; const sdkHeaders = getSdkHeaders(TransitGatewayApisV1.DEFAULT_SERVICE_NAME, 'v1', 'listTransitGateways'); @@ -171,7 +178,11 @@ class TransitGatewayApisV1 extends BaseService { /** * Creates a Transit Gateway. * - * Create a Transit Gateway based on the supplied input template. + * Create a Transit Gateway based on the supplied input template. Required fields: `name` (string, 1–60 chars), + * `location` (IBM Cloud region, e.g. us-south). Optional fields: `global` (boolean, enables cross-region routing), + * `resource_group` (object with `id`), `redundancy_group` (string, name of the redundancy group to join), + * `gre_enhanced_route_propagation` (boolean). Returns a `TransitGateway` object. Initial `status` will be `pending` + * while provisioning. * * @param {Object} params - The parameters to send to the service. * @param {string} params.location - Location of Transit Gateway Services. @@ -181,6 +192,10 @@ class TransitGatewayApisV1 extends BaseService { * @param {boolean} [params.greEnhancedRoutePropagation] - Allow route propagation across all GREs connected to the * same transit gateway. This affects connections on the gateway of type `redundant_gre`, `unbound_gre_tunnel` and * `gre_tunnel`. + * @param {string} [params.redundancyGroup] - Include the global transit gateway in this redundancy group. When set, + * this transit gateway will be redundant to other transit gateways in this redundancy group. If this redundancy group + * doesn't exist in the account, it will be created. This property can only be set for global transit gateways and the + * transit gateway cannot be in a location already used by a global transit gateway in this redundancy group. * @param {ResourceGroupIdentity} [params.resourceGroup] - The resource group to use. If unspecified, the account's * [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers @@ -191,7 +206,7 @@ class TransitGatewayApisV1 extends BaseService { ): Promise> { const _params = { ...params }; const _requiredParams = ['location', 'name']; - const _validParams = ['location', 'name', 'global', 'greEnhancedRoutePropagation', 'resourceGroup', 'signal', 'headers']; + const _validParams = ['location', 'name', 'global', 'greEnhancedRoutePropagation', 'redundancyGroup', 'resourceGroup', 'signal', 'headers']; const _validationErrors = validateParams(_params, _requiredParams, _validParams); if (_validationErrors) { return Promise.reject(_validationErrors); @@ -202,6 +217,7 @@ class TransitGatewayApisV1 extends BaseService { 'name': _params.name, 'global': _params.global, 'gre_enhanced_route_propagation': _params.greEnhancedRoutePropagation, + 'redundancy_group': _params.redundancyGroup, 'resource_group': _params.resourceGroup, }; @@ -241,8 +257,8 @@ class TransitGatewayApisV1 extends BaseService { /** * Deletes specified Transit Gateway. * - * This request deletes a Transit Gateway. This operation cannot be reversed. For this request to succeed, the Transit - * Gateway must not contain connections. + * Delete a Transit Gateway specified by its `id` path parameter. This operation cannot be reversed. The gateway must + * have no attached connections before it can be deleted; remove all connections first. * * @param {Object} params - The parameters to send to the service. * @param {string} params.id - The Transit Gateway identifier. @@ -298,7 +314,10 @@ class TransitGatewayApisV1 extends BaseService { /** * Retrieves specified Transit Gateway. * - * This request retrieves a single Transit Gateway specified by the identifier in the URL. + * Retrieve a single Transit Gateway specified by its `id` path parameter. Returns a `TransitGateway` object + * containing: `id`, `name`, `crn`, `location`, + * `status`, `global`, `created_at`, `updated_at`, `resource_group`, and optionally + * `redundancy_group`, `redundancy_group_id`, `gre_enhanced_route_propagation`, and `connection_needs_attention`. * * @param {Object} params - The parameters to send to the service. * @param {string} params.id - The Transit Gateway identifier. @@ -355,15 +374,22 @@ class TransitGatewayApisV1 extends BaseService { /** * Updates specified Transit Gateway. * - * This request updates a Transit Gateway's name and/or global flag. + * Update a Transit Gateway specified by its `id` path parameter. Updatable fields: `name` (string), `global` + * (boolean), `redundancy_group` (string, assigns the gateway to a redundancy group), `gre_enhanced_route_propagation` + * (boolean). Returns the updated `TransitGateway` object. * * @param {Object} params - The parameters to send to the service. * @param {string} params.id - The Transit Gateway identifier. - * @param {boolean} [params.global] - Allow global routing for a Transit Gateway. + * @param {boolean} [params.global] - Allow global routing for a Transit Gateway. This property cannot be changed if + * the transit gateway has redundancy_group set. * @param {boolean} [params.greEnhancedRoutePropagation] - Allow route propagation across all GREs connected to the * same transit gateway. This affects connections on the gateway of type `redundant_gre`, `unbound_gre_tunnel` and * `gre_tunnel`. It takes a few minutes for the change to take effect. * @param {string} [params.name] - A human readable name for a resource. + * @param {string} [params.redundancyGroup] - Create a new redundancy group with this name and add the gateway to it. + * This property is only valid when the gateway is global (or `global` is set to `true` in the same request), the + * gateway is not already a member of a redundancy group, and no redundancy group with this name already exists in the + * account. * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers * @returns {Promise>} */ @@ -372,7 +398,7 @@ class TransitGatewayApisV1 extends BaseService { ): Promise> { const _params = { ...params }; const _requiredParams = ['id']; - const _validParams = ['id', 'global', 'greEnhancedRoutePropagation', 'name', 'signal', 'headers']; + const _validParams = ['id', 'global', 'greEnhancedRoutePropagation', 'name', 'redundancyGroup', 'signal', 'headers']; const _validationErrors = validateParams(_params, _requiredParams, _validParams); if (_validationErrors) { return Promise.reject(_validationErrors); @@ -382,6 +408,7 @@ class TransitGatewayApisV1 extends BaseService { 'global': _params.global, 'gre_enhanced_route_propagation': _params.greEnhancedRoutePropagation, 'name': _params.name, + 'redundancy_group': _params.redundancyGroup, }; const query = { @@ -428,7 +455,11 @@ class TransitGatewayApisV1 extends BaseService { /** * Retrieves all connections. * - * List all transit gateway connections associated with this account. + * List all transit gateway connections associated with this account. Results can be filtered by `network_id` or + * `network_type`. Use the `limit` and `start` parameters to page through large result sets. The response includes a + * `TransitConnection` object for each connection, containing fields such as `id`, `name`, `network_type`, + * `status`, `created_at`, `updated_at`, and optionally `prefix_filters`, `request_status`, and `transit_gateway` + * reference. * * @param {Object} [params] - The parameters to send to the service. * @param {number} [params.limit] - The maximum number of resources to return per page. @@ -570,10 +601,11 @@ class TransitGatewayApisV1 extends BaseService { * required for network type `unbound_gre_tunnel` and must be set to `classic`. For a `redundant_gre` network type, * the value is required and can be either VPC or Classic. This field is required to be unspecified for network type * `classic`, `directlink`, `vpc`, `power_virtual_server`, `vpn_gateway` and `gre_tunnel` connections. - * @param {string} [params.cidr] - network_type 'vpn_gateway' connections use 'cidr' to specify the CIDR to use for - * the VPN GRE tunnels. + * @param {string} [params.cidr] - network_type `vpn_gateway` connections use `cidr` to specify the CIDR to use for + * the VPN gateway GRE tunnels. * - * This field is required for network type `vpn_gateway` connections. + * This field is optional for network type `vpn_gateway` connections. If unspecified, the default value is + * 198.19.174.0/23. * * This field is required to be unspecified for network type `classic`, `directlink`, `vpc`, `power_virtual_server`, * `gre_tunnel`, `unbound_gre_tunnel`, and `redundant_gre` connections. @@ -599,11 +631,11 @@ class TransitGatewayApisV1 extends BaseService { * `unbound_gre_tunnel` when the associated_network_type is `classic` or network_type is `redundant_gre` and the GRE * tunnel is in a different account than the gateway. * @param {string} [params.networkId] - The ID of the network being connected via this connection. For network types - * `vpc`,`power_virtual_server`, `directlink` and `vpn_gateway` this is the CRN of the VPC / PowerVS / VDC / Direct - * Link / VPN gateway respectively. This field is required for network type `vpc`, `power_virtual_server`, - * `vpn_gateway`, and `directlink` connections. It is also required for `redundant_gre` connections when the - * base_network_type is set to VPC. This field is required to be unspecified for network type `classic`, `gre_tunnel` - * and `unbound_gre_tunnel` connections. + * `vpc`, `vpn_gateway`, `power_virtual_server` and `directlink` this is the CRN of the VPC / VPN / PowerVS / Direct + * Link gateway respectively. This field is required for network type `vpc`, `power_virtual_server`, `vpn_gateway` and + * `directlink` connections. It is also required for `redundant_gre` connections when the base_network_type is set to + * VPC. This field is required to be unspecified for network type `classic`, `gre_tunnel` and `unbound_gre_tunnel` + * connections. * @param {TransitGatewayConnectionPrefixFilter[]} [params.prefixFilters] - Array of prefix route filters for a * transit gateway connection. Prefix filters can be specified for netowrk type `vpc`, `classic`, * `power_virtual_server` and `directlink` connections. They are not allowed for type `gre_tunnel` connections. This @@ -2021,6 +2053,183 @@ class TransitGatewayApisV1 extends BaseService { }), }; + return this.createRequest(parameters); + } + /************************* + * redundancyGroups + ************************/ + + /** + * Lists all redundancy groups in the account. + * + * List all redundancy groups for the account. + * + * @param {Object} [params] - The parameters to send to the service. + * @param {string} [params.name] - Filter the list of redundancy groups by name. + * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers + * @returns {Promise>} + */ + public listRedundancyGroups( + params?: TransitGatewayApisV1.ListRedundancyGroupsParams + ): Promise> { + const _params = { ...params }; + const _requiredParams = []; + const _validParams = ['name', 'signal', 'headers']; + const _validationErrors = validateParams(_params, _requiredParams, _validParams); + if (_validationErrors) { + return Promise.reject(_validationErrors); + } + + const query = { + 'version': this.version, + 'name': _params.name, + }; + + const sdkHeaders = getSdkHeaders(TransitGatewayApisV1.DEFAULT_SERVICE_NAME, 'v1', 'listRedundancyGroups'); + + const parameters = { + options: { + url: '/redundancy_groups', + method: 'GET', + qs: query, + }, + defaultOptions: extend(true, {}, this.baseOptions, { + headers: extend( + true, + sdkHeaders, + this.baseOptions.headers, + { + 'Accept': 'application/json', + }, + _params.headers + ), + axiosOptions: { + signal: _params.signal, + }, + }), + }; + + return this.createRequest(parameters); + } + + /** + * Retrieves specified redundancy group. + * + * Retrieves a single redundancy group specified by the identifier in the URL. + * + * @param {Object} params - The parameters to send to the service. + * @param {string} params.id - The redundancy group identifier. + * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers + * @returns {Promise>} + */ + public getRedundancyGroup( + params: TransitGatewayApisV1.GetRedundancyGroupParams + ): Promise> { + const _params = { ...params }; + const _requiredParams = ['id']; + const _validParams = ['id', 'signal', 'headers']; + const _validationErrors = validateParams(_params, _requiredParams, _validParams); + if (_validationErrors) { + return Promise.reject(_validationErrors); + } + + const query = { + 'version': this.version, + }; + + const path = { + 'id': _params.id, + }; + + const sdkHeaders = getSdkHeaders(TransitGatewayApisV1.DEFAULT_SERVICE_NAME, 'v1', 'getRedundancyGroup'); + + const parameters = { + options: { + url: '/redundancy_groups/{id}', + method: 'GET', + qs: query, + path, + }, + defaultOptions: extend(true, {}, this.baseOptions, { + headers: extend( + true, + sdkHeaders, + this.baseOptions.headers, + { + 'Accept': 'application/json', + }, + _params.headers + ), + axiosOptions: { + signal: _params.signal, + }, + }), + }; + + return this.createRequest(parameters); + } + + /** + * Updates a redundancy group. + * + * Update a redundancy group. + * + * @param {Object} params - The parameters to send to the service. + * @param {string} params.id - The redundancy group identifier. + * @param {string} [params.name] - The new name for the redundancy group. + * @param {OutgoingHttpHeaders} [params.headers] - Custom request headers + * @returns {Promise>} + */ + public updateRedundancyGroup( + params: TransitGatewayApisV1.UpdateRedundancyGroupParams + ): Promise> { + const _params = { ...params }; + const _requiredParams = ['id']; + const _validParams = ['id', 'name', 'signal', 'headers']; + const _validationErrors = validateParams(_params, _requiredParams, _validParams); + if (_validationErrors) { + return Promise.reject(_validationErrors); + } + + const body = { + 'name': _params.name, + }; + + const query = { + 'version': this.version, + }; + + const path = { + 'id': _params.id, + }; + + const sdkHeaders = getSdkHeaders(TransitGatewayApisV1.DEFAULT_SERVICE_NAME, 'v1', 'updateRedundancyGroup'); + + const parameters = { + options: { + url: '/redundancy_groups/{id}', + method: 'PATCH', + body, + qs: query, + path, + }, + defaultOptions: extend(true, {}, this.baseOptions, { + headers: extend( + true, + sdkHeaders, + this.baseOptions.headers, + { + 'Accept': 'application/json', + 'Content-Type': 'application/merge-patch+json', + }, + _params.headers + ), + axiosOptions: { + signal: _params.signal, + }, + }), + }; + return this.createRequest(parameters); } } @@ -2072,6 +2281,8 @@ namespace TransitGatewayApisV1 { limit?: number; /** A server supplied token determining which resource to start the page on. */ start?: string; + /** Filter the list of transit gateways by redundancy group name. */ + redundancyGroup?: string; } /** Parameters for the `createTransitGateway` operation. */ @@ -2086,6 +2297,12 @@ namespace TransitGatewayApisV1 { * the gateway of type `redundant_gre`, `unbound_gre_tunnel` and `gre_tunnel`. */ greEnhancedRoutePropagation?: boolean; + /** Include the global transit gateway in this redundancy group. When set, this transit gateway will be + * redundant to other transit gateways in this redundancy group. If this redundancy group doesn't exist in the + * account, it will be created. This property can only be set for global transit gateways and the transit gateway + * cannot be in a location already used by a global transit gateway in this redundancy group. + */ + redundancyGroup?: string; /** The resource group to use. If unspecified, the account's [default resource * group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. */ @@ -2108,7 +2325,9 @@ namespace TransitGatewayApisV1 { export interface UpdateTransitGatewayParams extends DefaultParams { /** The Transit Gateway identifier. */ id: string; - /** Allow global routing for a Transit Gateway. */ + /** Allow global routing for a Transit Gateway. This property cannot be changed if the transit gateway has + * redundancy_group set. + */ global?: boolean; /** Allow route propagation across all GREs connected to the same transit gateway. This affects connections on * the gateway of type `redundant_gre`, `unbound_gre_tunnel` and `gre_tunnel`. It takes a few minutes for the @@ -2117,6 +2336,11 @@ namespace TransitGatewayApisV1 { greEnhancedRoutePropagation?: boolean; /** A human readable name for a resource. */ name?: string; + /** Create a new redundancy group with this name and add the gateway to it. This property is only valid when the + * gateway is global (or `global` is set to `true` in the same request), the gateway is not already a member of a + * redundancy group, and no redundancy group with this name already exists in the account. + */ + redundancyGroup?: string; } /** Parameters for the `listConnections` operation. */ @@ -2165,9 +2389,11 @@ namespace TransitGatewayApisV1 { * `directlink`, `vpc`, `power_virtual_server`, `vpn_gateway` and `gre_tunnel` connections. */ baseNetworkType?: CreateTransitGatewayConnectionConstants.BaseNetworkType | string; - /** network_type 'vpn_gateway' connections use 'cidr' to specify the CIDR to use for the VPN GRE tunnels. + /** network_type `vpn_gateway` connections use `cidr` to specify the CIDR to use for the VPN gateway GRE + * tunnels. * - * This field is required for network type `vpn_gateway` connections. + * This field is optional for network type `vpn_gateway` connections. If unspecified, the default value is + * 198.19.174.0/23. * * This field is required to be unspecified for network type `classic`, `directlink`, `vpc`, * `power_virtual_server`, `gre_tunnel`, `unbound_gre_tunnel`, and `redundant_gre` connections. @@ -2202,9 +2428,9 @@ namespace TransitGatewayApisV1 { * account than the gateway. */ networkAccountId?: string; - /** The ID of the network being connected via this connection. For network types `vpc`,`power_virtual_server`, - * `directlink` and `vpn_gateway` this is the CRN of the VPC / PowerVS / VDC / Direct Link / VPN gateway - * respectively. This field is required for network type `vpc`, `power_virtual_server`, `vpn_gateway`, and + /** The ID of the network being connected via this connection. For network types `vpc`, `vpn_gateway`, + * `power_virtual_server` and `directlink` this is the CRN of the VPC / VPN / PowerVS / Direct Link gateway + * respectively. This field is required for network type `vpc`, `power_virtual_server`, `vpn_gateway` and * `directlink` connections. It is also required for `redundant_gre` connections when the base_network_type is set * to VPC. This field is required to be unspecified for network type `classic`, `gre_tunnel` and * `unbound_gre_tunnel` connections. @@ -2588,6 +2814,26 @@ namespace TransitGatewayApisV1 { id: string; } + /** Parameters for the `listRedundancyGroups` operation. */ + export interface ListRedundancyGroupsParams extends DefaultParams { + /** Filter the list of redundancy groups by name. */ + name?: string; + } + + /** Parameters for the `getRedundancyGroup` operation. */ + export interface GetRedundancyGroupParams extends DefaultParams { + /** The redundancy group identifier. */ + id: string; + } + + /** Parameters for the `updateRedundancyGroup` operation. */ + export interface UpdateRedundancyGroupParams extends DefaultParams { + /** The redundancy group identifier. */ + id: string; + /** The new name for the redundancy group. */ + name?: string; + } + /************************* * model interfaces ************************/ @@ -2710,6 +2956,28 @@ namespace TransitGatewayApisV1 { } } + /** + * A redundancy group. + */ + export interface RedundancyGroup { + /** The date and time that this redundancy group was created. */ + created_at: string; + /** The unique identifier for this redundancy group. */ + id: string; + /** The redundancy group name. */ + name: string; + /** The date and time that this redundancy group was last updated. */ + updated_at?: string; + } + + /** + * A list of redundancy groups. + */ + export interface RedundancyGroupCollection { + /** Collection of redundancy groups. */ + redundancy_groups: RedundancyGroup[]; + } + /** * The resource group to use. If unspecified, the account's [default resource * group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. @@ -2773,13 +3041,13 @@ namespace TransitGatewayApisV1 { */ export interface RouteReportConnection { /** Array of connection's bgps. */ - bgps?: RouteReportConnectionBgp[]; + bgps: RouteReportConnectionBgp[]; /** connection ID. */ id?: string; /** connection name. */ name?: string; /** Array of connection's routes. */ - routes?: RouteReportConnectionRoute[]; + routes: RouteReportConnectionRoute[]; /** connection type. */ type?: string; } @@ -2821,7 +3089,7 @@ namespace TransitGatewayApisV1 { */ export interface RouteReportOverlappingRouteGroup { /** Array of overlapping connection/prefix pairs. */ - routes?: RouteReportOverlappingRoute[]; + routes: RouteReportOverlappingRoute[]; } /** @@ -2841,7 +3109,7 @@ namespace TransitGatewayApisV1 { /** The name of the location. */ name: string; /** Array of supported connection types. */ - supported_connection_types?: string[]; + supported_connection_types: string[]; /** The type of the location, determining is this a multi-zone region, a single data center, or a point of * presence. The list of enumerated values for this property may expand in the future. Code and processes using * this field must tolerate unexpected values. @@ -2900,8 +3168,8 @@ namespace TransitGatewayApisV1 { name: string; /** The ID of the network being connected via this connection. This field is required for some types, such as * `vpc`, `power_virtual_server`, `directlink`, `vpn_gateway` and `redundant_gre`. For network types `vpc`, - * `redundant_gre`, `power_virtual_server` and `directlink` this is the CRN of the VPC / PowerVS / VDC / Direct - * Link gateway respectively. + * `vpn_gateway`, `power_virtual_server` and `directlink` this is the CRN of the VPC / VPN / PowerVS / Direct Link + * gateway respectively. */ network_id?: string; /** Defines what type of network is connected via this connection. The list of enumerated values for this @@ -2917,6 +3185,10 @@ namespace TransitGatewayApisV1 { * `gre_tunnel` connections. */ base_connection_id?: string; + /** network_type `vpn_gateway` connections use `cidr` to specify the CIDR to use for the `VPN gateway` GRE + * tunnels. + */ + cidr?: string; /** The date and time that this connection was created. */ created_at: string; /** Local network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` @@ -2984,7 +3256,6 @@ namespace TransitGatewayApisV1 { export enum BaseNetworkType { CLASSIC = 'classic', VPC = 'vpc', - VPN = 'vpn', } /** Defines what type of network is connected via this connection. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. */ export enum NetworkType { @@ -3063,6 +3334,12 @@ namespace TransitGatewayApisV1 { location: string; /** A human readable name for the transit gateway. */ name: string; + /** The redundancy group for this global transit gateway. The global transit gateways in this redundancy group + * will be redundant to each other. + */ + redundancy_group?: string; + /** The unique identifier of the redundancy group for this global transit gateway. */ + redundancy_group_id?: string; /** The resource group to use. If unspecified, the account's [default resource * group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. */ @@ -3139,7 +3416,9 @@ namespace TransitGatewayApisV1 { * `directlink`, `vpc`, `power_virtual_server`, `vpn_gateway` and `gre_tunnel` connections. */ base_network_type?: TransitGatewayConnectionCust.Constants.BaseNetworkType | string; - /** network_type 'vpn_gateway' connections use 'cidr' to specify the CIDR to use for the VPN GRE tunnels. */ + /** network_type `vpn_gateway` connections use `cidr` to specify the CIDR to use for the `VPN gateway` GRE + * tunnels. + */ cidr?: string; /** The date and time that this connection was created. */ created_at: string; @@ -3172,9 +3451,9 @@ namespace TransitGatewayApisV1 { * IBM Cloud account than the gateway. */ network_account_id?: string; - /** The ID of the network being connected via this connection. For network types `vpc`,`power_virtual_server`, - * `directlink` and `vpn_gateway` this is the CRN of the VPC / PowerVS / VDC / Direct Link / VPN gateway - * respectively. This field is required for network type `vpc`, `power_virtual_server`, `vpn_gateway`, and + /** The ID of the network being connected via this connection. For network types `vpc`, `vpn_gateway`, + * `power_virtual_server` and `directlink` this is the CRN of the VPC / VPN / PowerVS / Direct Link gateway + * respectively. This field is required for network type `vpc`, `power_virtual_server`, `vpn_gateway` and * `directlink` connections. It is also required for `redundant_gre` connections when the base_network_type is set * to VPC. This field is required to be unspecified for network type `classic`, `gre_tunnel` and * `unbound_gre_tunnel` connections. @@ -3228,7 +3507,6 @@ namespace TransitGatewayApisV1 { export enum BaseNetworkType { CLASSIC = 'classic', VPC = 'vpc', - VPN = 'vpn', } /** Defines what type of network is connected via this connection. */ export enum NetworkType { @@ -3406,7 +3684,6 @@ namespace TransitGatewayApisV1 { export enum BaseNetworkType { CLASSIC = 'classic', VPC = 'vpc', - VPN = 'vpn', } /** Tunnel's current configuration state. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. */ export enum Status {