Skip to content

Commit e6f7b27

Browse files
feat(DirectLink): implement the DLaaS changes for Direct link gateway
* Add connection_mode to Create/Update/Actions api for direct link gateways to specify the type of service this gateway attaches to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic connection
1 parent 146a6f3 commit e6f7b27

File tree

4 files changed

+289
-15
lines changed

4 files changed

+289
-15
lines changed

ibm_cloud_networking_services/direct_link_v1.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ def update_gateway(self,
263263
id: str,
264264
*,
265265
authentication_key: 'GatewayPatchTemplateAuthenticationKey' = None,
266+
connection_mode: str = None,
266267
global_: bool = None,
267268
loa_reject_reason: str = None,
268269
macsec_config: 'GatewayMacsecConfigPatchTemplate' = None,
@@ -283,6 +284,12 @@ def update_gateway(self,
283284
The key material that you provide must be base64 encoded and original
284285
string must be maximum 126 ASCII characters in length.
285286
To clear the optional `authentication_key` field patch its crn to `""`.
287+
:param str connection_mode: (optional) Type of services this Gateway is
288+
attached to. Mode transit means this Gateway will be attached to Transit
289+
Gateway Service and direct means this Gateway will be attached to vpc or
290+
classic connection. The list of enumerated values for this property may
291+
expand in the future. Code and processes using this field must tolerate
292+
unexpected values.
286293
:param bool global_: (optional) Gateways with global routing (`true`) can
287294
connect to networks outside of their associated region.
288295
:param str loa_reject_reason: (optional) Use this field during LOA
@@ -326,6 +333,7 @@ def update_gateway(self,
326333

327334
data = {
328335
'authentication_key': authentication_key,
336+
'connection_mode': connection_mode,
329337
'global': global_,
330338
'loa_reject_reason': loa_reject_reason,
331339
'macsec_config': macsec_config,
@@ -358,6 +366,7 @@ def create_gateway_action(self,
358366
action: str,
359367
*,
360368
authentication_key: 'GatewayActionTemplateAuthenticationKey' = None,
369+
connection_mode: str = None,
361370
global_: bool = None,
362371
metered: bool = None,
363372
resource_group: 'ResourceGroupIdentity' = None,
@@ -379,6 +388,12 @@ def create_gateway_action(self,
379388
The key material that you provide must be base64 encoded and original
380389
string must be maximum 126 ASCII characters in length.
381390
To clear the optional `authentication_key` field patch its crn to `""`.
391+
:param str connection_mode: (optional) Type of services this Gateway is
392+
attached to. Mode transit means this Gateway will be attached to Transit
393+
Gateway Service and direct means this Gateway will be attached to vpc or
394+
classic connection. The list of enumerated values for this property may
395+
expand in the future. Code and processes using this field must tolerate
396+
unexpected values.
382397
:param bool global_: (optional) Required for create_gateway_approve
383398
requests to select the gateway's routing option. Gateways with global
384399
routing (`true`) can connect to networks outside of their associated
@@ -422,6 +437,7 @@ def create_gateway_action(self,
422437
data = {
423438
'action': action,
424439
'authentication_key': authentication_key,
440+
'connection_mode': connection_mode,
425441
'global': global_,
426442
'metered': metered,
427443
'resource_group': resource_group,
@@ -1285,6 +1301,11 @@ class Gateway():
12851301
:attr str completion_notice_reject_reason: (optional) Reason for completion
12861302
notice rejection. Only included on type=dedicated gateways with a rejected
12871303
completion notice.
1304+
:attr str connection_mode: (optional) Type of services this Gateway is attached
1305+
to. Mode transit means this Gateway will be attached to Transit Gateway Service
1306+
and direct means this Gateway will be attached to vpc or classic connection. The
1307+
list of enumerated values for this property may expand in the future. Code and
1308+
processes using this field must tolerate unexpected values.
12881309
:attr datetime created_at: The date and time resource was created.
12891310
:attr str crn: The CRN (Cloud Resource Name) of this gateway.
12901311
:attr str cross_connect_router: (optional) Cross connect router. Only included
@@ -1346,6 +1367,7 @@ def __init__(self,
13461367
carrier_name: str = None,
13471368
change_request: 'GatewayChangeRequest' = None,
13481369
completion_notice_reject_reason: str = None,
1370+
connection_mode: str = None,
13491371
cross_connect_router: str = None,
13501372
customer_name: str = None,
13511373
link_status: str = None,
@@ -1400,6 +1422,12 @@ def __init__(self,
14001422
:param str completion_notice_reject_reason: (optional) Reason for
14011423
completion notice rejection. Only included on type=dedicated gateways with
14021424
a rejected completion notice.
1425+
:param str connection_mode: (optional) Type of services this Gateway is
1426+
attached to. Mode transit means this Gateway will be attached to Transit
1427+
Gateway Service and direct means this Gateway will be attached to vpc or
1428+
classic connection. The list of enumerated values for this property may
1429+
expand in the future. Code and processes using this field must tolerate
1430+
unexpected values.
14031431
:param str cross_connect_router: (optional) Cross connect router. Only
14041432
included on type=dedicated gateways.
14051433
:param str customer_name: (optional) Customer name. Only set for
@@ -1429,6 +1457,7 @@ def __init__(self,
14291457
self.carrier_name = carrier_name
14301458
self.change_request = change_request
14311459
self.completion_notice_reject_reason = completion_notice_reject_reason
1460+
self.connection_mode = connection_mode
14321461
self.created_at = created_at
14331462
self.crn = crn
14341463
self.cross_connect_router = cross_connect_router
@@ -1475,6 +1504,8 @@ def from_dict(cls, _dict: Dict) -> 'Gateway':
14751504
args['change_request'] = _dict.get('change_request')
14761505
if 'completion_notice_reject_reason' in _dict:
14771506
args['completion_notice_reject_reason'] = _dict.get('completion_notice_reject_reason')
1507+
if 'connection_mode' in _dict:
1508+
args['connection_mode'] = _dict.get('connection_mode')
14781509
if 'created_at' in _dict:
14791510
args['created_at'] = string_to_datetime(_dict.get('created_at'))
14801511
else:
@@ -1565,6 +1596,8 @@ def to_dict(self) -> Dict:
15651596
_dict['change_request'] = self.change_request
15661597
if hasattr(self, 'completion_notice_reject_reason') and self.completion_notice_reject_reason is not None:
15671598
_dict['completion_notice_reject_reason'] = self.completion_notice_reject_reason
1599+
if hasattr(self, 'connection_mode') and self.connection_mode is not None:
1600+
_dict['connection_mode'] = self.connection_mode
15681601
if hasattr(self, 'created_at') and self.created_at is not None:
15691602
_dict['created_at'] = datetime_to_string(self.created_at)
15701603
if hasattr(self, 'crn') and self.crn is not None:
@@ -1634,6 +1667,18 @@ class BgpStatusEnum(Enum):
16341667
IDLE = "idle"
16351668

16361669

1670+
class ConnectionModeEnum(Enum):
1671+
"""
1672+
Type of services this Gateway is attached to. Mode transit means this Gateway will
1673+
be attached to Transit Gateway Service and direct means this Gateway will be
1674+
attached to vpc or classic connection. The list of enumerated values for this
1675+
property may expand in the future. Code and processes using this field must
1676+
tolerate unexpected values.
1677+
"""
1678+
DIRECT = "direct"
1679+
TRANSIT = "transit"
1680+
1681+
16371682
class LinkStatusEnum(Enum):
16381683
"""
16391684
Gateway link status. Only included on type=dedicated gateways. The list of
@@ -3092,6 +3137,11 @@ class GatewayTemplate():
30923137
value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16",
30933138
"169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must
30943139
have matching network and subnet mask values.
3140+
:attr str connection_mode: (optional) Type of services this Gateway is attached
3141+
to. Mode transit means this Gateway will be attached to Transit Gateway Service
3142+
and direct means this Gateway will be attached to vpc or classic connection. The
3143+
list of enumerated values for this property may expand in the future. Code and
3144+
processes using this field must tolerate unexpected values.
30953145
:attr bool global_: Gateways with global routing (`true`) can connect to
30963146
networks outside their associated region.
30973147
:attr bool metered: Metered billing option. When `true` gateway usage is billed
@@ -3117,6 +3167,7 @@ def __init__(self,
31173167
bgp_base_cidr: str = None,
31183168
bgp_cer_cidr: str = None,
31193169
bgp_ibm_cidr: str = None,
3170+
connection_mode: str = None,
31203171
resource_group: 'ResourceGroupIdentity' = None) -> None:
31213172
"""
31223173
Initialize a GatewayTemplate object.
@@ -3155,6 +3206,12 @@ def __init__(self,
31553206
the value must reside in one of "10.254.0.0/16", "172.16.0.0/12",
31563207
"192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr
31573208
and bgp_ibm_cidr must have matching network and subnet mask values.
3209+
:param str connection_mode: (optional) Type of services this Gateway is
3210+
attached to. Mode transit means this Gateway will be attached to Transit
3211+
Gateway Service and direct means this Gateway will be attached to vpc or
3212+
classic connection. The list of enumerated values for this property may
3213+
expand in the future. Code and processes using this field must tolerate
3214+
unexpected values.
31583215
:param ResourceGroupIdentity resource_group: (optional) Resource group for
31593216
this resource. If unspecified, the account's [default resource
31603217
group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is
@@ -3164,6 +3221,18 @@ def __init__(self,
31643221
", ".join(['GatewayTemplateGatewayTypeDedicatedTemplate', 'GatewayTemplateGatewayTypeConnectTemplate']))
31653222
raise Exception(msg)
31663223

3224+
class ConnectionModeEnum(Enum):
3225+
"""
3226+
Type of services this Gateway is attached to. Mode transit means this Gateway will
3227+
be attached to Transit Gateway Service and direct means this Gateway will be
3228+
attached to vpc or classic connection. The list of enumerated values for this
3229+
property may expand in the future. Code and processes using this field must
3230+
tolerate unexpected values.
3231+
"""
3232+
DIRECT = "direct"
3233+
TRANSIT = "transit"
3234+
3235+
31673236
class TypeEnum(Enum):
31683237
"""
31693238
Offering type.
@@ -4698,6 +4767,11 @@ class GatewayTemplateGatewayTypeConnectTemplate(GatewayTemplate):
46984767
value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16",
46994768
"169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must
47004769
have matching network and subnet mask values.
4770+
:attr str connection_mode: (optional) Type of services this Gateway is attached
4771+
to. Mode transit means this Gateway will be attached to Transit Gateway Service
4772+
and direct means this Gateway will be attached to vpc or classic connection. The
4773+
list of enumerated values for this property may expand in the future. Code and
4774+
processes using this field must tolerate unexpected values.
47014775
:attr bool global_: Gateways with global routing (`true`) can connect to
47024776
networks outside their associated region.
47034777
:attr bool metered: Metered billing option. When `true` gateway usage is billed
@@ -4725,6 +4799,7 @@ def __init__(self,
47254799
bgp_base_cidr: str = None,
47264800
bgp_cer_cidr: str = None,
47274801
bgp_ibm_cidr: str = None,
4802+
connection_mode: str = None,
47284803
resource_group: 'ResourceGroupIdentity' = None) -> None:
47294804
"""
47304805
Initialize a GatewayTemplateGatewayTypeConnectTemplate object.
@@ -4766,6 +4841,12 @@ def __init__(self,
47664841
the value must reside in one of "10.254.0.0/16", "172.16.0.0/12",
47674842
"192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr
47684843
and bgp_ibm_cidr must have matching network and subnet mask values.
4844+
:param str connection_mode: (optional) Type of services this Gateway is
4845+
attached to. Mode transit means this Gateway will be attached to Transit
4846+
Gateway Service and direct means this Gateway will be attached to vpc or
4847+
classic connection. The list of enumerated values for this property may
4848+
expand in the future. Code and processes using this field must tolerate
4849+
unexpected values.
47694850
:param ResourceGroupIdentity resource_group: (optional) Resource group for
47704851
this resource. If unspecified, the account's [default resource
47714852
group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is
@@ -4777,6 +4858,7 @@ def __init__(self,
47774858
self.bgp_base_cidr = bgp_base_cidr
47784859
self.bgp_cer_cidr = bgp_cer_cidr
47794860
self.bgp_ibm_cidr = bgp_ibm_cidr
4861+
self.connection_mode = connection_mode
47804862
self.global_ = global_
47814863
self.metered = metered
47824864
self.name = name
@@ -4801,6 +4883,8 @@ def from_dict(cls, _dict: Dict) -> 'GatewayTemplateGatewayTypeConnectTemplate':
48014883
args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr')
48024884
if 'bgp_ibm_cidr' in _dict:
48034885
args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr')
4886+
if 'connection_mode' in _dict:
4887+
args['connection_mode'] = _dict.get('connection_mode')
48044888
if 'global' in _dict:
48054889
args['global_'] = _dict.get('global')
48064890
else:
@@ -4847,6 +4931,8 @@ def to_dict(self) -> Dict:
48474931
_dict['bgp_cer_cidr'] = self.bgp_cer_cidr
48484932
if hasattr(self, 'bgp_ibm_cidr') and self.bgp_ibm_cidr is not None:
48494933
_dict['bgp_ibm_cidr'] = self.bgp_ibm_cidr
4934+
if hasattr(self, 'connection_mode') and self.connection_mode is not None:
4935+
_dict['connection_mode'] = self.connection_mode
48504936
if hasattr(self, 'global_') and self.global_ is not None:
48514937
_dict['global'] = self.global_
48524938
if hasattr(self, 'metered') and self.metered is not None:
@@ -4881,6 +4967,18 @@ def __ne__(self, other: 'GatewayTemplateGatewayTypeConnectTemplate') -> bool:
48814967
"""Return `true` when self and other are not equal, false otherwise."""
48824968
return not self == other
48834969

4970+
class ConnectionModeEnum(Enum):
4971+
"""
4972+
Type of services this Gateway is attached to. Mode transit means this Gateway will
4973+
be attached to Transit Gateway Service and direct means this Gateway will be
4974+
attached to vpc or classic connection. The list of enumerated values for this
4975+
property may expand in the future. Code and processes using this field must
4976+
tolerate unexpected values.
4977+
"""
4978+
DIRECT = "direct"
4979+
TRANSIT = "transit"
4980+
4981+
48844982
class TypeEnum(Enum):
48854983
"""
48864984
Offering type.
@@ -4920,6 +5018,11 @@ class GatewayTemplateGatewayTypeDedicatedTemplate(GatewayTemplate):
49205018
value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16",
49215019
"169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must
49225020
have matching network and subnet mask values.
5021+
:attr str connection_mode: (optional) Type of services this Gateway is attached
5022+
to. Mode transit means this Gateway will be attached to Transit Gateway Service
5023+
and direct means this Gateway will be attached to vpc or classic connection. The
5024+
list of enumerated values for this property may expand in the future. Code and
5025+
processes using this field must tolerate unexpected values.
49235026
:attr bool global_: Gateways with global routing (`true`) can connect to
49245027
networks outside their associated region.
49255028
:attr bool metered: Metered billing option. When `true` gateway usage is billed
@@ -4955,6 +5058,7 @@ def __init__(self,
49555058
bgp_base_cidr: str = None,
49565059
bgp_cer_cidr: str = None,
49575060
bgp_ibm_cidr: str = None,
5061+
connection_mode: str = None,
49585062
resource_group: 'ResourceGroupIdentity' = None,
49595063
macsec_config: 'GatewayMacsecConfigTemplate' = None) -> None:
49605064
"""
@@ -4999,6 +5103,12 @@ def __init__(self,
49995103
the value must reside in one of "10.254.0.0/16", "172.16.0.0/12",
50005104
"192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr
50015105
and bgp_ibm_cidr must have matching network and subnet mask values.
5106+
:param str connection_mode: (optional) Type of services this Gateway is
5107+
attached to. Mode transit means this Gateway will be attached to Transit
5108+
Gateway Service and direct means this Gateway will be attached to vpc or
5109+
classic connection. The list of enumerated values for this property may
5110+
expand in the future. Code and processes using this field must tolerate
5111+
unexpected values.
50025112
:param ResourceGroupIdentity resource_group: (optional) Resource group for
50035113
this resource. If unspecified, the account's [default resource
50045114
group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is
@@ -5012,6 +5122,7 @@ def __init__(self,
50125122
self.bgp_base_cidr = bgp_base_cidr
50135123
self.bgp_cer_cidr = bgp_cer_cidr
50145124
self.bgp_ibm_cidr = bgp_ibm_cidr
5125+
self.connection_mode = connection_mode
50155126
self.global_ = global_
50165127
self.metered = metered
50175128
self.name = name
@@ -5040,6 +5151,8 @@ def from_dict(cls, _dict: Dict) -> 'GatewayTemplateGatewayTypeDedicatedTemplate'
50405151
args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr')
50415152
if 'bgp_ibm_cidr' in _dict:
50425153
args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr')
5154+
if 'connection_mode' in _dict:
5155+
args['connection_mode'] = _dict.get('connection_mode')
50435156
if 'global' in _dict:
50445157
args['global_'] = _dict.get('global')
50455158
else:
@@ -5100,6 +5213,8 @@ def to_dict(self) -> Dict:
51005213
_dict['bgp_cer_cidr'] = self.bgp_cer_cidr
51015214
if hasattr(self, 'bgp_ibm_cidr') and self.bgp_ibm_cidr is not None:
51025215
_dict['bgp_ibm_cidr'] = self.bgp_ibm_cidr
5216+
if hasattr(self, 'connection_mode') and self.connection_mode is not None:
5217+
_dict['connection_mode'] = self.connection_mode
51035218
if hasattr(self, 'global_') and self.global_ is not None:
51045219
_dict['global'] = self.global_
51055220
if hasattr(self, 'metered') and self.metered is not None:
@@ -5142,6 +5257,18 @@ def __ne__(self, other: 'GatewayTemplateGatewayTypeDedicatedTemplate') -> bool:
51425257
"""Return `true` when self and other are not equal, false otherwise."""
51435258
return not self == other
51445259

5260+
class ConnectionModeEnum(Enum):
5261+
"""
5262+
Type of services this Gateway is attached to. Mode transit means this Gateway will
5263+
be attached to Transit Gateway Service and direct means this Gateway will be
5264+
attached to vpc or classic connection. The list of enumerated values for this
5265+
property may expand in the future. Code and processes using this field must
5266+
tolerate unexpected values.
5267+
"""
5268+
DIRECT = "direct"
5269+
TRANSIT = "transit"
5270+
5271+
51455272
class TypeEnum(Enum):
51465273
"""
51475274
Offering type.

0 commit comments

Comments
 (0)