Skip to content

Commit 2a44c1a

Browse files
authored
Merge pull request #90 from IBM/as_prepends
feat(as prepends): added as prepends to direct link
2 parents 9922794 + 88bf4bc commit 2a44c1a

File tree

5 files changed

+568
-15
lines changed

5 files changed

+568
-15
lines changed

direct-link/v1.ts

Lines changed: 236 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* (C) Copyright IBM Corp. 2021, 2022.
2+
* (C) Copyright IBM Corp. 2022.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
1515
*/
1616

1717
/**
18-
* IBM OpenAPI SDK Code Generator Version: 3.43.0-49eab5c7-20211117-152138
18+
* IBM OpenAPI SDK Code Generator Version: 3.60.2-95dc7721-20221102-203229
1919
*/
2020

2121
import * as extend from 'extend';
@@ -105,6 +105,134 @@ class DirectLinkV1 extends BaseService {
105105
this.version = options.version;
106106
}
107107

108+
/*************************
109+
* gatewayASPrepends
110+
************************/
111+
112+
/**
113+
* List AS Prepends.
114+
*
115+
* Retrieve all AS Prepends for the specified Direct Link gateway.
116+
*
117+
* @param {Object} params - The parameters to send to the service.
118+
* @param {string} params.gatewayId - Direct Link gateway identifier.
119+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
120+
* @returns {Promise<DirectLinkV1.Response<DirectLinkV1.AsPrependCollection>>}
121+
*/
122+
public listGatewayAsPrepends(
123+
params: DirectLinkV1.ListGatewayAsPrependsParams
124+
): Promise<DirectLinkV1.Response<DirectLinkV1.AsPrependCollection>> {
125+
const _params = { ...params };
126+
const requiredParams = ['gatewayId'];
127+
128+
const missingParams = getMissingParams(_params, requiredParams);
129+
if (missingParams) {
130+
return Promise.reject(missingParams);
131+
}
132+
133+
const query = {
134+
'version': this.version,
135+
};
136+
137+
const path = {
138+
'gateway_id': _params.gatewayId,
139+
};
140+
141+
const sdkHeaders = getSdkHeaders(
142+
DirectLinkV1.DEFAULT_SERVICE_NAME,
143+
'v1',
144+
'listGatewayAsPrepends'
145+
);
146+
147+
const parameters = {
148+
options: {
149+
url: '/gateways/{gateway_id}/as_prepends',
150+
method: 'GET',
151+
qs: query,
152+
path,
153+
},
154+
defaultOptions: extend(true, {}, this.baseOptions, {
155+
headers: extend(
156+
true,
157+
sdkHeaders,
158+
{
159+
'Accept': 'application/json',
160+
},
161+
_params.headers
162+
),
163+
}),
164+
};
165+
166+
return this.createRequest(parameters);
167+
}
168+
169+
/**
170+
* Replace existing AS Prepends.
171+
*
172+
* Replace the given set of AS prepends on the specified gateway. Existing resources may be reused when the
173+
* individual AS Prepend item is unchanged.
174+
*
175+
* @param {Object} params - The parameters to send to the service.
176+
* @param {string} params.gatewayId - Direct Link gateway identifier.
177+
* @param {string} params.ifMatch - If present, the request will fail if the specified ETag value does not match the
178+
* resource's current ETag value.
179+
* @param {AsPrependPrefixArrayTemplate[]} [params.asPrepends] - array of AS Prepend configuration information.
180+
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
181+
* @returns {Promise<DirectLinkV1.Response<DirectLinkV1.AsPrependCollection>>}
182+
*/
183+
public replaceGatewayAsPrepends(
184+
params: DirectLinkV1.ReplaceGatewayAsPrependsParams
185+
): Promise<DirectLinkV1.Response<DirectLinkV1.AsPrependCollection>> {
186+
const _params = { ...params };
187+
const requiredParams = ['gatewayId', 'ifMatch'];
188+
189+
const missingParams = getMissingParams(_params, requiredParams);
190+
if (missingParams) {
191+
return Promise.reject(missingParams);
192+
}
193+
194+
const body = {
195+
'as_prepends': _params.asPrepends,
196+
};
197+
198+
const query = {
199+
'version': this.version,
200+
};
201+
202+
const path = {
203+
'gateway_id': _params.gatewayId,
204+
};
205+
206+
const sdkHeaders = getSdkHeaders(
207+
DirectLinkV1.DEFAULT_SERVICE_NAME,
208+
'v1',
209+
'replaceGatewayAsPrepends'
210+
);
211+
212+
const parameters = {
213+
options: {
214+
url: '/gateways/{gateway_id}/as_prepends',
215+
method: 'PUT',
216+
body,
217+
qs: query,
218+
path,
219+
},
220+
defaultOptions: extend(true, {}, this.baseOptions, {
221+
headers: extend(
222+
true,
223+
sdkHeaders,
224+
{
225+
'Accept': 'application/json',
226+
'Content-Type': 'application/json',
227+
'If-Match': _params.ifMatch,
228+
},
229+
_params.headers
230+
),
231+
}),
232+
};
233+
234+
return this.createRequest(parameters);
235+
}
108236
/*************************
109237
* gateways
110238
************************/
@@ -459,6 +587,8 @@ class DirectLinkV1 extends BaseService {
459587
* @param {Object} params - The parameters to send to the service.
460588
* @param {string} params.id - Direct Link Connect gateway identifier.
461589
* @param {string} params.action - Action request.
590+
* @param {AsPrependTemplate[]} [params.asPrepends] - Applicable for create_gateway_approve requests to create AS
591+
* Prepends. Contains an array of AS Prepend configuration information.
462592
* @param {GatewayActionTemplateAuthenticationKey} [params.authenticationKey] - Applicable for create_gateway_approve
463593
* requests to select the gateway's BGP MD5 authentication key.
464594
* The key material that you provide must be base64 encoded and original string must be maximum 126 ASCII characters
@@ -498,6 +628,7 @@ class DirectLinkV1 extends BaseService {
498628

499629
const body = {
500630
'action': _params.action,
631+
'as_prepends': _params.asPrepends,
501632
'authentication_key': _params.authenticationKey,
502633
'bfd_config': _params.bfdConfig,
503634
'connection_mode': _params.connectionMode,
@@ -1496,6 +1627,26 @@ namespace DirectLinkV1 {
14961627
* request interfaces
14971628
************************/
14981629

1630+
/** Parameters for the `listGatewayAsPrepends` operation. */
1631+
export interface ListGatewayAsPrependsParams {
1632+
/** Direct Link gateway identifier. */
1633+
gatewayId: string;
1634+
headers?: OutgoingHttpHeaders;
1635+
}
1636+
1637+
/** Parameters for the `replaceGatewayAsPrepends` operation. */
1638+
export interface ReplaceGatewayAsPrependsParams {
1639+
/** Direct Link gateway identifier. */
1640+
gatewayId: string;
1641+
/** If present, the request will fail if the specified ETag value does not match the resource's current ETag
1642+
* value.
1643+
*/
1644+
ifMatch: string;
1645+
/** array of AS Prepend configuration information. */
1646+
asPrepends?: AsPrependPrefixArrayTemplate[];
1647+
headers?: OutgoingHttpHeaders;
1648+
}
1649+
14991650
/** Parameters for the `listGateways` operation. */
15001651
export interface ListGatewaysParams {
15011652
headers?: OutgoingHttpHeaders;
@@ -1617,6 +1768,10 @@ namespace DirectLinkV1 {
16171768
id: string;
16181769
/** Action request. */
16191770
action: CreateGatewayActionConstants.Action | string;
1771+
/** Applicable for create_gateway_approve requests to create AS Prepends. Contains an array of AS Prepend
1772+
* configuration information.
1773+
*/
1774+
asPrepends?: AsPrependTemplate[];
16201775
/** Applicable for create_gateway_approve requests to select the gateway's BGP MD5 authentication key.
16211776
* The key material that you provide must be base64 encoded and original string must be maximum 126 ASCII
16221777
* characters in length.
@@ -1884,6 +2039,80 @@ namespace DirectLinkV1 {
18842039
* model interfaces
18852040
************************/
18862041

2042+
/** Gateway AS Prepend object. */
2043+
export interface AsPrepend {
2044+
/** The date and time resource was created. */
2045+
created_at?: string;
2046+
/** The unique identifier for this AS Prepend. */
2047+
id?: string;
2048+
/** Number of times the ASN to appended to the AS Path. */
2049+
length?: number;
2050+
/** Route type this AS Prepend applies to. */
2051+
policy?: string;
2052+
/** Deprecated: Comma separated list of prefixes this AS Prepend applies to. If empty, this applies to all
2053+
* prefixes.
2054+
*/
2055+
prefix?: string;
2056+
/** Array of prefixes this AS Prepend applies to. This parameter is not returned when AS Prepend applies to all
2057+
* prefixes. Note that ordering is not significant and may differ from request order.
2058+
*/
2059+
specific_prefixes?: string[];
2060+
/** The date and time resource was last updated. */
2061+
updated_at?: string;
2062+
}
2063+
2064+
/** array of AS Prepends. */
2065+
export interface AsPrependCollection {
2066+
/** array of AS Prepend information. */
2067+
as_prepends?: AsPrependEntry[];
2068+
}
2069+
2070+
/** AS Prepends API object. */
2071+
export interface AsPrependEntry {
2072+
/** The date and time resource was created. */
2073+
created_at?: string;
2074+
/** The unique identifier for this AS Prepend. */
2075+
id?: string;
2076+
/** Number of times the ASN to appended to the AS Path. */
2077+
length?: number;
2078+
/** Route type this AS Prepend applies to. */
2079+
policy?: string;
2080+
/** Array of prefixes this AS Prepend applies to. This parameter is not returned when AS Prepend applies to all
2081+
* prefixes. Note that ordering is not significant and may differ from request order.
2082+
*/
2083+
specific_prefixes?: string[];
2084+
/** The date and time resource was last updated. */
2085+
updated_at?: string;
2086+
}
2087+
2088+
/** Create AS Prepend Configuration template. */
2089+
export interface AsPrependPrefixArrayTemplate {
2090+
/** Number of times the ASN to be prepended to the AS Path. */
2091+
length: number;
2092+
/** Route type this AS Prepend applies to. */
2093+
policy: string;
2094+
/** Array of prefixes this AS Prepend applies to. If this property is absent, the AS Prepend applies to all
2095+
* prefixes. Note that ordering is not significant and may differ from request order.
2096+
*/
2097+
specific_prefixes?: string[];
2098+
}
2099+
2100+
/** Create AS Prepend Configuration template. */
2101+
export interface AsPrependTemplate {
2102+
/** Number of times the ASN to be prepended to the AS Path. */
2103+
length: number;
2104+
/** Route type this AS Prepend applies to. */
2105+
policy: string;
2106+
/** Deprecated: Comma separated list of prefixes this AS Prepend applies to. Maximum of 10 prefixes. If not
2107+
* specified, this AS Prepend applies to all prefixes.
2108+
*/
2109+
prefix?: string;
2110+
/** Array of prefixes this AS Prepend applies to. If this property is absent, the AS Prepend applies to all
2111+
* prefixes.
2112+
*/
2113+
specific_prefixes?: string[];
2114+
}
2115+
18872116
/** Cross Connect Router details. */
18882117
export interface CrossConnectRouter {
18892118
/** Array of capabilities for this router. */
@@ -1896,6 +2125,8 @@ namespace DirectLinkV1 {
18962125

18972126
/** gateway. */
18982127
export interface Gateway {
2128+
/** array of AS Prepend information. */
2129+
as_prepends?: AsPrepend[];
18992130
/** The identity of the standard key to use for BGP MD5 authentication key.
19002131
* The key material that you provide must be base64 encoded and original string must be maximum 126 ASCII
19012132
* characters in length.
@@ -2268,11 +2499,14 @@ namespace DirectLinkV1 {
22682499

22692500
/** gateway status. */
22702501
export interface GatewayStatusCollection {
2502+
/** array of status. */
22712503
status?: GatewayStatus[];
22722504
}
22732505

22742506
/** Create gateway template. */
22752507
export interface GatewayTemplate {
2508+
/** array of AS Prepend configuration information. */
2509+
as_prepends?: AsPrependTemplate[];
22762510
/** The identity of the standard key to use for BGP MD5 authentication key.
22772511
* The key material that you provide must be base64 encoded and original string must be maximum 126 ASCII
22782512
* characters in length.

directlink.env.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export AUTH_TYPE=iam
2+
export IAMAPIKEY=<API-KEY>
3+
export LOCATION_NAME=dal09
4+
export LOCATION_DISPLAY_NAME="Dallas 09"
5+
export SERVICE_URL=https://directlink.test.cloud.ibm.com/v1
6+
export IAMURL=https://iam.test.cloud.ibm.com/identity/token
7+
export GEN2_VPC_CRN=crn:v1:staging:public:is:us-south:a/3b1bd7fa2bc3406ea70ba4ade8aa3f1b::vpc:r134-1680db5a-7672-41af-89fb-bbbc94ac6964
8+
export AUTHENTICATION_KEY=crn:v1:staging:public:is:us-south:a/3b1bd7fa2bc3406ea70ba4ade8aa3f1b::vpc:r134-1680db5a-7672-41af-89fb-bbbc94ac6964

package-lock.json

Lines changed: 10 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)