def __init__(self): required_args.add_argument('--remote-endpoint-public-ip', required=True, help='L3 VPN Remote end point\'s public ip') required_args.add_argument('--passphrase', required=True, help='Passphrase used for VPN') self.args = parser.parse_args() self.nsx_client = create_nsx_policy_client_for_vmc( refresh_token=self.args.refresh_token, org_id=self.args.org_id, sddc_id=self.args.sddc_id)
def __init__(self): optional_args.add_argument('--notes', default='Sample public IP ' + str(random.randint(0, 100)), help='Notes of the new public IP') optional_args.add_argument('--fw-rule-name', default='Sample firewall rule ' + str(random.randint(0, 100)), help='Name of the compute gae') optional_args.add_argument('--nat-rule-description', default='Sample NAT rule ' + str(random.randint(0, 100)), help='Description for the NAT rule') required_args.add_argument('--internal-ip', required=True, help='Private IP of the VM') optional_args.add_argument('--cleardata', action='store_true', help='Clean up after sample run') args = parser.parse_args() self.network_id = None self.edge_id = None self.nat_rule_id = None self.public_ip = None self.nfwr = None self.org_id = args.org_id self.sddc_id = args.sddc_id self.notes = args.notes self.fw_rule_name = args.fw_rule_name self.nat_rule_description = args.nat_rule_description self.internal_ip = args.internal_ip self.cleardata = args.cleardata self.vmc_client = create_vmc_client(args.refresh_token)
from vmware.vapi.lib import connect from vmware.vapi.security.user_password import \ create_user_password_security_context from vmware.vapi.stdlib.client.factories import StubConfigurationFactory """ Create a new NSX-T Group on MGW or CGW Sample Prerequisites: - SDDC deployed in VMware Cloud on AWS """ optional_args.add_argument('--gateway_type', default='mgw', help='Gateway type. Either mgw or cgw') required_args.add_argument('--name', required=True, help='Name of the security group to be created') optional_args.add_argument('--ip_address', default='172.31.0.0/24', help='IP address for the expression') optional_args.add_argument('--group_id', help='ID of the group. A random ID will be used by default') args = parser.parse_args() gateway_type = args.gateway_type.lower() id = args.group_id or 'AppGroup-{}'.format(random.randint(1, 10))
from vmware.vapi.security.user_password import \ create_user_password_security_context from vmware.vapi.stdlib.client.factories import StubConfigurationFactory """ Update a NSX-T Group on MGW or CGW Sample Prerequisites: - SDDC deployed in VMware Cloud on AWS - A NSX-T security group """ optional_args.add_argument('--gateway-type', default='mgw', help='Gateway type. Either mgw or cgw') required_args.add_argument('--group-id', required=True, help='ID of the group to be updated') required_args.add_argument('--name', required=True, help='New name of the security group to be updated') args = parser.parse_args() gateway_type = args.gateway_type.lower() nsx_client = create_nsx_policy_client_for_vmc(refresh_token=args.refresh_token, org_id=args.org_id, sddc_id=args.sddc_id) try: