Skip to content

Commit 4a3bed9

Browse files
authored
feat: Support for directlink tgw connection type (#50)
1 parent c994ce6 commit 4a3bed9

File tree

3 files changed

+23
-49
lines changed

3 files changed

+23
-49
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ before_install:
1010

1111
jobs:
1212
include:
13-
- stage: Node JS 10
14-
node_js: 10
1513
- stage: Node JS 12
1614
node_js: 12
1715

test/unit/transit-gateway-apis.v1.test.js

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,7 @@ describe('TransitGatewayApisV1', () => {
540540
transitGatewayId: transitGatewayId,
541541
};
542542

543-
const listTransitGatewayConnectionsResult = transitGatewayApisService.listTransitGatewayConnections(
544-
params
545-
);
543+
const listTransitGatewayConnectionsResult = transitGatewayApisService.listTransitGatewayConnections(params);
546544

547545
// all methods should return a Promise
548546
expectToBePromise(listTransitGatewayConnectionsResult);
@@ -620,8 +618,7 @@ describe('TransitGatewayApisV1', () => {
620618
const localTunnelIp = '192.168.129.2';
621619
const name = 'Transit_Service_BWTN_SJ_DL';
622620
const networkAccountId = '28e4d90ac7504be694471ee66e70d0d5';
623-
const networkId =
624-
'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b';
621+
const networkId = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b';
625622
const remoteBgpAsn = '65010';
626623
const remoteGatewayIp = '10.242.63.12';
627624
const remoteTunnelIp = '192.168.129.1';
@@ -641,9 +638,7 @@ describe('TransitGatewayApisV1', () => {
641638
zone: zone,
642639
};
643640

644-
const createTransitGatewayConnectionResult = transitGatewayApisService.createTransitGatewayConnection(
645-
params
646-
);
641+
const createTransitGatewayConnectionResult = transitGatewayApisService.createTransitGatewayConnection(params);
647642

648643
// all methods should return a Promise
649644
expectToBePromise(createTransitGatewayConnectionResult);
@@ -727,9 +722,7 @@ describe('TransitGatewayApisV1', () => {
727722
id: id,
728723
};
729724

730-
const deleteTransitGatewayConnectionResult = transitGatewayApisService.deleteTransitGatewayConnection(
731-
params
732-
);
725+
const deleteTransitGatewayConnectionResult = transitGatewayApisService.deleteTransitGatewayConnection(params);
733726

734727
// all methods should return a Promise
735728
expectToBePromise(deleteTransitGatewayConnectionResult);
@@ -739,11 +732,7 @@ describe('TransitGatewayApisV1', () => {
739732

740733
const options = getOptions(createRequestMock);
741734

742-
checkUrlAndMethod(
743-
options,
744-
'/transit_gateways/{transit_gateway_id}/connections/{id}',
745-
'DELETE'
746-
);
735+
checkUrlAndMethod(options, '/transit_gateways/{transit_gateway_id}/connections/{id}', 'DELETE');
747736
const expectedAccept = undefined;
748737
const expectedContentType = undefined;
749738
checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType);
@@ -807,9 +796,7 @@ describe('TransitGatewayApisV1', () => {
807796
id: id,
808797
};
809798

810-
const getTransitGatewayConnectionResult = transitGatewayApisService.getTransitGatewayConnection(
811-
params
812-
);
799+
const getTransitGatewayConnectionResult = transitGatewayApisService.getTransitGatewayConnection(params);
813800

814801
// all methods should return a Promise
815802
expectToBePromise(getTransitGatewayConnectionResult);
@@ -819,11 +806,7 @@ describe('TransitGatewayApisV1', () => {
819806

820807
const options = getOptions(createRequestMock);
821808

822-
checkUrlAndMethod(
823-
options,
824-
'/transit_gateways/{transit_gateway_id}/connections/{id}',
825-
'GET'
826-
);
809+
checkUrlAndMethod(options, '/transit_gateways/{transit_gateway_id}/connections/{id}', 'GET');
827810
const expectedAccept = 'application/json';
828811
const expectedContentType = undefined;
829812
checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType);
@@ -889,9 +872,7 @@ describe('TransitGatewayApisV1', () => {
889872
name: name,
890873
};
891874

892-
const updateTransitGatewayConnectionResult = transitGatewayApisService.updateTransitGatewayConnection(
893-
params
894-
);
875+
const updateTransitGatewayConnectionResult = transitGatewayApisService.updateTransitGatewayConnection(params);
895876

896877
// all methods should return a Promise
897878
expectToBePromise(updateTransitGatewayConnectionResult);
@@ -901,11 +882,7 @@ describe('TransitGatewayApisV1', () => {
901882

902883
const options = getOptions(createRequestMock);
903884

904-
checkUrlAndMethod(
905-
options,
906-
'/transit_gateways/{transit_gateway_id}/connections/{id}',
907-
'PATCH'
908-
);
885+
checkUrlAndMethod(options, '/transit_gateways/{transit_gateway_id}/connections/{id}', 'PATCH');
909886
const expectedAccept = 'application/json';
910887
const expectedContentType = 'application/json';
911888
checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType);
@@ -972,9 +949,7 @@ describe('TransitGatewayApisV1', () => {
972949
action: action,
973950
};
974951

975-
const createTransitGatewayConnectionActionsResult = transitGatewayApisService.createTransitGatewayConnectionActions(
976-
params
977-
);
952+
const createTransitGatewayConnectionActionsResult = transitGatewayApisService.createTransitGatewayConnectionActions(params);
978953

979954
// all methods should return a Promise
980955
expectToBePromise(createTransitGatewayConnectionActionsResult);
@@ -984,11 +959,7 @@ describe('TransitGatewayApisV1', () => {
984959

985960
const options = getOptions(createRequestMock);
986961

987-
checkUrlAndMethod(
988-
options,
989-
'/transit_gateways/{transit_gateway_id}/connections/{id}/actions',
990-
'POST'
991-
);
962+
checkUrlAndMethod(options, '/transit_gateways/{transit_gateway_id}/connections/{id}/actions', 'POST');
992963
const expectedAccept = undefined;
993964
const expectedContentType = 'application/json';
994965
checkMediaHeaders(createRequestMock, expectedAccept, expectedContentType);

transit-gateway-apis/v1.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,9 @@ class TransitGatewayApisV1 extends BaseService {
475475
* Generally only used if the network is in a different account than the gateway. This field is required to be
476476
* unspecified for network type 'gre_tunnel'.
477477
* @param {string} [params.networkId] - The ID of the network being connected via this connection. This field is
478-
* required for some types, such as 'vpc'. For network type 'vpc' this is the CRN of the VPC to be connected. This
479-
* field is required to be unspecified for network type 'classic' and 'gre_tunnel' connections.
478+
* required for some types, such as 'vpc' and 'directlink'. For network types 'vpc' and 'directlink' this is the CRN
479+
* of the VPC / Direct Link gateway respectively. This field is required to be unspecified for network type 'classic'
480+
* and 'gre_tunnel' connections.
480481
* @param {string} [params.remoteBgpAsn] - Remote network BGP ASN. This field is only applicable to 'gre_tunnel' type
481482
* connections. The following ASN values are reserved and unavailable 64512-64513, 65100, 65201-65234, 65402-65433,
482483
* 65500 and 4201065000-4201065999. If 'remote_bgp_asn' is omitted on gre_tunnel connection create requests IBM will
@@ -988,8 +989,9 @@ namespace TransitGatewayApisV1 {
988989
*/
989990
networkAccountId?: string;
990991
/** The ID of the network being connected via this connection. This field is required for some types, such as
991-
* 'vpc'. For network type 'vpc' this is the CRN of the VPC to be connected. This field is required to be
992-
* unspecified for network type 'classic' and 'gre_tunnel' connections.
992+
* 'vpc' and 'directlink'. For network types 'vpc' and 'directlink' this is the CRN of the VPC / Direct Link
993+
* gateway respectively. This field is required to be unspecified for network type 'classic' and 'gre_tunnel'
994+
* connections.
993995
*/
994996
networkId?: string;
995997
/** Remote network BGP ASN. This field is only applicable to 'gre_tunnel' type connections. The following ASN
@@ -1018,9 +1020,10 @@ namespace TransitGatewayApisV1 {
10181020
export namespace CreateTransitGatewayConnectionConstants {
10191021
/** Defines what type of network is connected via this connection. For access to gre_tunnel connections contact IBM support. */
10201022
export enum NetworkType {
1021-
VPC = 'vpc',
10221023
CLASSIC = 'classic',
1024+
DIRECTLINK = 'directlink',
10231025
GRE_TUNNEL = 'gre_tunnel',
1026+
VPC = 'vpc',
10241027
}
10251028
}
10261029

@@ -1178,7 +1181,8 @@ namespace TransitGatewayApisV1 {
11781181
*/
11791182
network_account_id?: string;
11801183
/** The ID of the network being connected via this connection. This field is required for some types, such as
1181-
* 'vpc'. For network type 'vpc' this is the CRN of the VPC to be connected.
1184+
* 'vpc' and 'directlink'. For network types 'vpc' and 'directlink' it should be the CRN of the target vpc /
1185+
* gateway respectively.
11821186
*/
11831187
network_id?: string;
11841188
/** Defines what type of network is connected via this connection. The list of enumerated values for this
@@ -1297,7 +1301,8 @@ namespace TransitGatewayApisV1 {
12971301
/** The user-defined name for this transit gateway connection. */
12981302
name: string;
12991303
/** The ID of the network being connected via this connection. This field is required for some types, such as
1300-
* 'vpc'. For network type 'vpc' this is the CRN of the VPC to be connected.
1304+
* 'vpc' and 'directlink'. For network types 'vpc' and 'directlink' it should be the CRN of the target vpc /
1305+
* gateway respectively.
13011306
*/
13021307
network_id?: string;
13031308
/** Defines what type of network is connected via this connection. The list of enumerated values for this

0 commit comments

Comments
 (0)