Skip to content

Commit 2f66282

Browse files
Merge pull request #17 from IBM/macsec
feat: added the support for macsec enabled gateway
2 parents d2bb577 + 2e6be90 commit 2f66282

File tree

3 files changed

+413
-2
lines changed

3 files changed

+413
-2
lines changed

direct-link/v1.ts

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,11 @@ class DirectLinkV1 extends BaseService {
289289
* rejection.
290290
*
291291
* Only allowed for type=dedicated gateways.
292+
* @param {GatewayMacsecConfigPatchTemplate} [params.macsecConfig] - MACsec configuration information. When patching
293+
* any macsec_config fields, no other fields may be specified in the patch request. Contact IBM support for access to
294+
* MACsec.
295+
*
296+
* Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F].
292297
* @param {boolean} [params.metered] - Metered billing option. When `true` gateway usage is billed per gigabyte.
293298
* When `false` there is no per gigabyte usage charge, instead a flat rate is charged for the gateway.
294299
* @param {string} [params.name] - The unique user-defined name for this gateway.
@@ -315,6 +320,7 @@ class DirectLinkV1 extends BaseService {
315320
const body = {
316321
'global': _params.global,
317322
'loa_reject_reason': _params.loaRejectReason,
323+
'macsec_config': _params.macsecConfig,
318324
'metered': _params.metered,
319325
'name': _params.name,
320326
'operational_status': _params.operationalStatus,
@@ -580,6 +586,56 @@ class DirectLinkV1 extends BaseService {
580586
});
581587
};
582588

589+
/**
590+
* Gateway statistics.
591+
*
592+
* Retrieve gateway statistics. Specify statistic to retrieve using required `type` query parameter.
593+
*
594+
* @param {Object} params - The parameters to send to the service.
595+
* @param {string} params.id - Direct Link Dedicated gateway identifier.
596+
* @param {string} params.type - specify statistic to retrieve.
597+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
598+
* @returns {Promise<DirectLinkV1.Response<DirectLinkV1.GatewayStatisticCollection>>}
599+
*/
600+
public getGatewayStatistics(params: DirectLinkV1.GetGatewayStatisticsParams): Promise<DirectLinkV1.Response<DirectLinkV1.GatewayStatisticCollection>> {
601+
const _params = extend({}, params);
602+
const requiredParams = ['id', 'type'];
603+
604+
return new Promise((resolve, reject) => {
605+
const missingParams = getMissingParams(_params, requiredParams);
606+
if (missingParams) {
607+
return reject(missingParams);
608+
}
609+
610+
const query = {
611+
'type': _params.type,
612+
'version': this.version
613+
};
614+
615+
const path = {
616+
'id': _params.id
617+
};
618+
619+
const sdkHeaders = getSdkHeaders(DirectLinkV1.DEFAULT_SERVICE_NAME, 'v1', 'getGatewayStatistics');
620+
621+
const parameters = {
622+
options: {
623+
url: '/gateways/{id}/statistics',
624+
method: 'GET',
625+
qs: query,
626+
path,
627+
},
628+
defaultOptions: extend(true, {}, this.baseOptions, {
629+
headers: extend(true, sdkHeaders, {
630+
'Accept': 'application/json',
631+
}, _params.headers),
632+
}),
633+
};
634+
635+
return resolve(this.createRequest(parameters));
636+
});
637+
};
638+
583639
/*************************
584640
* offeringInformation
585641
************************/
@@ -1182,6 +1238,12 @@ namespace DirectLinkV1 {
11821238
* Only allowed for type=dedicated gateways.
11831239
*/
11841240
loaRejectReason?: string;
1241+
/** MACsec configuration information. When patching any macsec_config fields, no other fields may be specified
1242+
* in the patch request. Contact IBM support for access to MACsec.
1243+
*
1244+
* Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F].
1245+
*/
1246+
macsecConfig?: GatewayMacsecConfigPatchTemplate;
11851247
/** Metered billing option. When `true` gateway usage is billed per gigabyte. When `false` there is no per
11861248
* gigabyte usage charge, instead a flat rate is charged for the gateway.
11871249
*/
@@ -1275,6 +1337,24 @@ namespace DirectLinkV1 {
12751337
headers?: OutgoingHttpHeaders;
12761338
}
12771339

1340+
/** Parameters for the `getGatewayStatistics` operation. */
1341+
export interface GetGatewayStatisticsParams {
1342+
/** Direct Link Dedicated gateway identifier. */
1343+
id: string;
1344+
/** specify statistic to retrieve. */
1345+
type: GetGatewayStatisticsConstants.Type | string;
1346+
headers?: OutgoingHttpHeaders;
1347+
}
1348+
1349+
/** Constants for the `getGatewayStatistics` operation. */
1350+
export namespace GetGatewayStatisticsConstants {
1351+
/** specify statistic to retrieve. */
1352+
export enum Type {
1353+
MACSEC_MKA = 'macsec_mka',
1354+
MACSEC_SECURITY = 'macsec_security',
1355+
}
1356+
}
1357+
12781358
/** Parameters for the `listOfferingTypeLocations` operation. */
12791359
export interface ListOfferingTypeLocationsParams {
12801360
/** The Direct Link offering type. Current supported values are `"dedicated"` and `"connect"`. */
@@ -1476,6 +1556,10 @@ namespace DirectLinkV1 {
14761556
location_display_name: string;
14771557
/** Gateway location. */
14781558
location_name: string;
1559+
/** MACsec configuration information. For Dedicated Gateways with MACsec configured, return configuration
1560+
* information. Contact IBM support for access to MACsec.
1561+
*/
1562+
macsec_config?: GatewayMacsecConfig;
14791563
/** Metered billing option. When `true` gateway usage is billed per gigabyte. When `false` there is no per
14801564
* gigabyte usage charge, instead a flat rate is charged for the gateway.
14811565
*/
@@ -1516,6 +1600,84 @@ namespace DirectLinkV1 {
15161600
gateways: Gateway[];
15171601
}
15181602

1603+
/** MACsec connectivity association key. */
1604+
export interface GatewayMacsecCak {
1605+
/** connectivity association key. */
1606+
crn: string;
1607+
}
1608+
1609+
/** MACsec configuration information. For Dedicated Gateways with MACsec configured, return configuration information. Contact IBM support for access to MACsec. */
1610+
export interface GatewayMacsecConfig {
1611+
/** Indicate whether MACsec protection should be active (true) or inactive (false) for this MACsec enabled
1612+
* gateway.
1613+
*/
1614+
active: boolean;
1615+
/** Active connectivity association key. Normally will be the same as the primary_cak. During CAK changes this
1616+
* field can be used to indicate which key is currently active.
1617+
*/
1618+
active_cak?: GatewayMacsecCak;
1619+
/** SAK cipher suite. */
1620+
cipher_suite?: string;
1621+
/** confidentiality offset. */
1622+
confidentiality_offset: number;
1623+
/** cryptographic algorithm. */
1624+
cryptographic_algorithm?: string;
1625+
/** fallback connectivity association key. */
1626+
fallback_cak?: GatewayMacsecCak;
1627+
/** key server priority. */
1628+
key_server_priority?: number;
1629+
/** desired primary connectivity association key. */
1630+
primary_cak: GatewayMacsecCak;
1631+
/** Secure Association Key (SAK) expiry time in seconds. */
1632+
sak_expiry_time?: number;
1633+
/** The current status of MACsec on the device for this gateway. Status 'unknown' is returned during gateway
1634+
* creation and deletion.
1635+
*/
1636+
status: string;
1637+
/** replay protection window size. */
1638+
window_size?: number;
1639+
}
1640+
1641+
/** MACsec configuration information. When patching any macsec_config fields, no other fields may be specified in the patch request. Contact IBM support for access to MACsec. Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F]. */
1642+
export interface GatewayMacsecConfigPatchTemplate {
1643+
/** Indicate whether MACsec protection should be active (true) or inactive (false) for this MACsec enabled
1644+
* gateway.
1645+
*/
1646+
active?: boolean;
1647+
/** Fallback connectivity association key. Keys used for MACsec configuration must have names with an even
1648+
* number of characters from [0-9a-fA-F].
1649+
*/
1650+
fallback_cak?: GatewayMacsecCak;
1651+
/** Desired primary connectivity association key. Keys for a MACsec configuration must have names with an even
1652+
* number of characters from [0-9a-fA-F].
1653+
*/
1654+
primary_cak?: GatewayMacsecCak;
1655+
/** Secure Association Key (SAK) expiry time in seconds. */
1656+
sak_expiry_time?: number;
1657+
/** replay protection window size. */
1658+
window_size?: number;
1659+
}
1660+
1661+
/** MACsec configuration information. Contact IBM support for access to MACsec. Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F]. */
1662+
export interface GatewayMacsecConfigTemplate {
1663+
/** Indicate whether MACsec protection should be active (true) or inactive (false) for this MACsec enabled
1664+
* gateway.
1665+
*/
1666+
active: boolean;
1667+
/** Fallback connectivity association key. Keys used for MACsec configuration must have names with an even
1668+
* number of characters from [0-9a-fA-F].
1669+
*/
1670+
fallback_cak?: GatewayMacsecCak;
1671+
/** Desired primary connectivity association key. Keys used for MACsec configuration must have names with an
1672+
* even number of characters from [0-9a-fA-F].
1673+
*/
1674+
primary_cak: GatewayMacsecCak;
1675+
/** Secure Association Key (SAK) expiry time in seconds. */
1676+
sak_expiry_time?: number;
1677+
/** replay protection window size. */
1678+
window_size?: number;
1679+
}
1680+
15191681
/** gateway port for type=connect gateways. */
15201682
export interface GatewayPort {
15211683
/** Port Identifier. */
@@ -1528,6 +1690,22 @@ namespace DirectLinkV1 {
15281690
id: string;
15291691
}
15301692

1693+
/** MACsec statistics. */
1694+
export interface GatewayStatistic {
1695+
/** Date and time data was collected. */
1696+
created_at: string;
1697+
/** statistics output. */
1698+
data: string;
1699+
/** statistic type. */
1700+
type: string;
1701+
}
1702+
1703+
/** gateway statistics. */
1704+
export interface GatewayStatisticCollection {
1705+
/** Collection of gateway statistics. */
1706+
statistics: GatewayStatistic[];
1707+
}
1708+
15311709
/** Create gateway template. */
15321710
export interface GatewayTemplate {
15331711
/** BGP ASN. */
@@ -1622,6 +1800,10 @@ namespace DirectLinkV1 {
16221800
display_name: string;
16231801
/** Location type. */
16241802
location_type: string;
1803+
/** Indicate whether location supports MACsec. Only returned for gateway type=dedicated locations. Contact IBM
1804+
* support for access to MACsec.
1805+
*/
1806+
macsec_enabled?: boolean;
16251807
/** Location market. */
16261808
market: string;
16271809
/** Location geography. Only present for locations where provisioning is enabled. */
@@ -1642,6 +1824,10 @@ namespace DirectLinkV1 {
16421824
export interface OfferingSpeed {
16431825
/** Link speed in megabits per second. */
16441826
link_speed: number;
1827+
/** Indicate whether speed supports MACsec. Only returned for gateway type=dedicated speeds. Contact IBM
1828+
* support for access to MACsec.
1829+
*/
1830+
macsec_enabled?: boolean;
16451831
}
16461832

16471833
/** OfferingSpeedCollection. */
@@ -1744,6 +1930,11 @@ namespace DirectLinkV1 {
17441930
customer_name: string;
17451931
/** Gateway location. */
17461932
location_name: string;
1933+
/** MACsec configuration information. Contact IBM support for access to MACsec.
1934+
*
1935+
* Keys used for MACsec configuration must have names with an even number of characters from [0-9a-fA-F].
1936+
*/
1937+
macsec_config?: GatewayMacsecConfigTemplate;
17471938
}
17481939

17491940
}

0 commit comments

Comments
 (0)