How to use the pyvcloud.vcloudair.VCA function in pyvcloud

To help you get started, we’ve selected a few pyvcloud examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vmware / pyvcloud / tests / extensions_tests.py View on Github external
def login_to_vcloud(self):
        """Login to vCloud"""
        username = config['vcloud']['username']
        password = config['vcloud']['password']
        service_type = VCA.VCA_SERVICE_TYPE_STANDALONE
        host = config['vcloud']['host']
        version = config['vcloud']['version']
        verify = config['vcloud']['verify']
        org = config['vcloud']['org']
        self.vca = VCA(host=host, username=username, service_type=service_type, version=version, verify=verify,
                       log=True)
        assert self.vca
        result = self.vca.login(password=password, org=org)
        assert result
github vmware / pyvcloud / tests / net_tests.py View on Github external
def login_to_vcloud(self):
        """Login to vCloud"""
        username = config['vcloud']['username']
        password = config['vcloud']['password']
        service_type = config['vcloud']['service_type']
        host = config['vcloud']['host']
        version = config['vcloud']['version']
        org = config['vcloud']['org']
        service = config['vcloud']['service']
        instance = config['vcloud']['instance']
        self.vca = VCA(
            host=host,
            username=username,
            service_type=service_type,
            version=version,
            verify=True,
            log=True)
        assert self.vca
        if VCA.VCA_SERVICE_TYPE_STANDALONE == service_type:
            result = self.vca.login(password=password, org=org)
            assert result
            result = self.vca.login(
                token=self.vca.token,
                org=org,
                org_url=self.vca.vcloud_session.org_url)
            assert result
        elif VCA.VCA_SERVICE_TYPE_VCHS == service_type:
github vmware / pyvcloud / tests / vca_type_tests.py View on Github external
def test_0003(self):
        """Identify vca is not vCloud Director Standalone"""
        vca = VCA(
            host='https://vca.vmware.com',
            username='',
            verify=True,
            log=True)
        assert vca is not None
        service_type = vca.get_service_type()
        assert service_type != VCA.VCA_SERVICE_TYPE_STANDALONE
github vmware / pyvcloud / tests / catalog_tests.py View on Github external
def login_to_vcloud(self):
        """Login to vCloud"""
        username = config['vcloud']['username']
        password = config['vcloud']['password']
        service_type = config['vcloud']['service_type']
        host = config['vcloud']['host']
        version = config['vcloud']['version']
        org = config['vcloud']['org']
        service = config['vcloud']['service']
        instance = config['vcloud']['instance']
        self.vca = VCA(
            host=host,
            username=username,
            service_type=service_type,
            version=version,
            verify=True,
            log=True)
        assert self.vca
        if VCA.VCA_SERVICE_TYPE_STANDALONE == service_type:
            result = self.vca.login(password=password, org=org)
            assert result
            result = self.vca.login(
                token=self.vca.token,
                org=org,
                org_url=self.vca.vcloud_session.org_url)
            assert result
        elif VCA.VCA_SERVICE_TYPE_SUBSCRIPTION == service_type:
github vmware / pyvcloud / tests / 00010_vcd_login.py View on Github external
def login_to_vcloud(self):
        """Login to vCloud"""
        username = config['vcloud']['username']
        password = config['vcloud']['password']
        service_type = config['vcloud']['service_type']
        host = config['vcloud']['host']
        version = config['vcloud']['version']
        org = config['vcloud']['org']
        self.vca = VCA(host=host,
                       username=username,
                       service_type=service_type,
                       version=version,
                       verify=config['vcloud']['verify'],
                       log=True)
        assert self.vca
        result = self.vca.login(password=password, org=org)
        assert result
github vmware / pyvcloud / tests / vca_type_tests.py View on Github external
def test_0021(self):
        """Identify vCloud Air vca"""
        vca = VCA(host='https://iam.vchs.vmware.com',
                  username='', verify=True, log=True)
        assert vca is not None
        service_type = vca.get_service_type()
        assert service_type == VCA.VCA_SERVICE_TYPE_VCA
github vmware / pyvcloud / tests / vca_type_tests.py View on Github external
def test_0022(self):
        """Identify vchs is not vCloud Air vca"""
        vca = VCA(
            host='https://vchs.vmware.com',
            username='',
            verify=True,
            log=True)
        assert vca is not None
        service_type = vca.get_service_type()
        assert service_type != VCA.VCA_SERVICE_TYPE_VCA
github vmware / container-service-extension / container_service_extension / provisioner.py View on Github external
def get_system_session(config):
        vca_system = VCA(host=config['vcd']['host'],
                         username=config['vcd']['username'],
                         service_type='vcd',
                         version=config['vcd']['api_version'],
                         verify=config['vcd']['verify'],
                         log=config['vcd']['log'])

        org_url = 'https://%s/cloud' % config['vcd']['host']
        r = vca_system.login(password=config['vcd']['password'],
                             org='System',
                             org_url=org_url)
        if not r:
            raise Exception('failed to login as system')
        r = vca_system.login(token=vca_system.token,
                             org='System',
                             org_url=vca_system.vcloud_session.org_url)
        if not r:
github ansible / ansible / lib / ansible / module_utils / vca.py View on Github external
def create_instance(self):
        service_type = self.params.get('service_type', DEFAULT_SERVICE_TYPE)
        if service_type == 'vcd':
            host = self.params['host']
        else:
            host = LOGIN_HOST[service_type]
        username = self.params['username']

        version = self.params.get('api_version')
        if service_type == 'vchs':
            version = '5.6'

        verify = self.params.get('validate_certs')

        return VCA(host=host, username=username,
                   service_type=SERVICE_MAP[service_type],
                   version=version, verify=verify)
github vmware / container-service-extension / scripts / unregister_extension.py View on Github external
import time, datetime, os, sys
from pyvcloud.vcloudair import VCA
from pyvcloud.system import System
from pyvcloud.helper.CommonUtils import convertPythonObjToStr

host = sys.argv[1]
username = 'administrator'
password = sys.argv[2]
org = 'System'
org_url = 'https://%s/cloud' % host
verify = False
log = True
version = '5.6'
extension_name = sys.argv[3]

vca = VCA(host=host, username=username, service_type='vcd',
          version=version, verify=verify, log=log)

result = vca.login(password=password, org=org, org_url=org_url)
print('connected: %s' % result)

system = System(session=vca.vcloud_session, verify=verify, log=log)

extension = system.get_extension(extension_name)
if extension == None:
    print('extension %s not found' % extension_name)
else:
    print(extension.attrib['name'])
    print(extension.attrib['href'])

result = system.enable_extension(extension_name,
                                 extension.attrib['href'],