-
Notifications
You must be signed in to change notification settings - Fork 2
aws
Place or validate an order for a VXC service to Amazon Web Services (AWS).
import megalib
x = megalib.aws(header, uid, b_uid, name, speed, aws_asn, account_num, asn='', mcr_connect=False, aws_auto='true', vlan='null', peering_type='private', auth_key='', cidr='', cust_ip='', aws_ip='', validate=False, prod=True)header (required) String Header
uid (required) String Service UID
b_uid (required) String B End Service UID (target AWS Megaport)
name (required) String Service Name
speed (required) Integer Rate Limit
aws_asn (required) Integer Amazon Web Services ASN (Autonomous System Number)
account_num (required) String Target AWS Account Number
asn Integer ASN (Autonomous System Number)
mcr_connect Boolean Is the A End attached to a MCR? True or False
aws_auto String Auto configuration of the MCR, 'true' or 'false'
vlan Integer VLAN (Virtual Local Area Network)
peering_type String AWS Peering Type (Private or Public)
auth_key String BGP MD5 Authentication Key
cidr String Advertised Prefixes
cust_ip String Customer BGP Peer IP Address
aws_ip String AWS BGP Peer IP Address
validate Boolean True = Validate, False = Order
prod Boolean Environment, True = https://api.megaport.com, False = https://api-staging.megaport.com
x.status_code Integer HTTPS Response Status Code
x.json Integer Response
x.currency String Currency
x.monthly_rate Integer Monthly Cost
x.uid String vxcJTechnicalServiceUid
# Import megalib
import megalib
# Authenticate user credentials using the megalib.login function
auth = megalib.login(input('username: '), input('password: '), input('tfa (leave black if not enabled): '), prod=False)
# Check if logging was successful by observing the HTTP Status Code
if auth.status_code == 200:
print('login successful')
# Order VXC to AWS using the megalib.aws function
aws = megalib.aws(auth.header, input('uid: '), input('aws target uid: '), input('name: '), input('speed: '),
input('aws asn: '), input('aws account number: '), input('asn: '), input('mcr connect: '),
input('aws auto: '), input('vlan: '), input('peering type: '), input('bgp md5 auth key: '),
input('advertised routes: '), input('bgp peering ip address: '),
input('aws bgp peering ip address'), validate=False, prod=True)
# Advise user if order was successful
if aws.status_code == 200:
print('aws vxc ordered successfully')
# Advise user if order failed
else:
print('aws vxc order failed')
# Advise user if login failed
else:
print('login failed')