def get_vapp_resource(self, vdc_name, vapp_name): org_resource = Org(self.client, resource=self.client.get_org()) vdc_resource = VDC( self.client, resource=org_resource.get_vdc(vdc_name)) vapp_resource_href = vdc_resource.get_resource_href( name=vapp_name, entity_type=EntityType.VAPP) return self.client.get_resource(vapp_resource_href)
def get_vapp_resource_resource_stateful(self): vapp = self.params.get('vapp') vdc = self.params.get('vdc') org_resource = Org(self.client, resource=self.client.get_org()) vdc_resource = VDC(self.client, resource=org_resource.get_vdc(vdc)) vapp_resource_href = vdc_resource.get_resource_href(name=vapp, entity_type=EntityType.VAPP) vapp_resource = self.client.get_resource(vapp_resource_href) return vapp_resource
def get_resource(self): vapp = self.params.get('vapp') vdc = self.params.get('vdc') org_resource = Org(self.client, resource=self.client.get_org()) vdc_resource = VDC(self.client, resource=org_resource.get_vdc(vdc)) vapp_resource_href = vdc_resource.get_resource_href(name=vapp, entity_type=EntityType.VAPP) vapp_resource = self.client.get_resource(vapp_resource_href) return vapp_resource
def get_resource(self): vapp = self.params.get('vapp') vdc = self.params.get('vdc') nic_id = self.params.get('nic_id') vm_name = self.params.get('vm_name') org_resource = Org(self.client, resource=self.client.get_org()) vdc_resource = VDC(self.client, resource=org_resource.get_vdc(vdc)) #vapp_vm_resource = self.get_vm() vapp_resource_href = vdc_resource.get_resource_href( name=vapp, entity_type=EntityType.VAPP) vapp_resource = self.client.get_resource(vapp_resource_href) return vapp_resource
def get_vapp_resources(module): ''' If source_vapp and source_catalog both are given then priority will be given to source_catalog. ''' client = module.client source_catalog_name = module.params.get('source_catalog_name', None) source_template_name = module.params.get('source_template_name', None) target_vapp = module.params.get('target_vapp', None) target_vdc = module.params.get('target_vdc', None) source_vdc = module.params.get('source_vdc', None) source_vapp = module.params.get('source_vapp', None) org_resource = Org(client, resource=client.get_org()) if source_vapp: source_vdc_resource = VDC(client, resource=org_resource.get_vdc(source_vdc)) target_vdc_resource = VDC(client, resource=org_resource.get_vdc(target_vdc)) source_vapp_resource_href = source_vdc_resource.get_resource_href( name=source_vapp, entity_type=EntityType.VAPP) target_vapp_resource_href = target_vdc_resource.get_resource_href( name=target_vapp, entity_type=EntityType.VAPP) source_vapp_resource = client.get_resource(source_vapp_resource_href) target_vapp_resource = client.get_resource(target_vapp_resource_href) if source_catalog_name: target_vdc_resource = VDC(client, resource=org_resource.get_vdc(target_vdc)) target_vapp_resource = target_vdc_resource.get_vapp(target_vapp) catalog_item = org_resource.get_catalog_item(source_catalog_name, source_template_name) source_vapp_resource = client.get_resource( catalog_item.Entity.get('href')) return source_vapp_resource, target_vapp_resource
def get_source_resource(self): source_catalog_name = self.params.get('source_catalog_name') source_template_name = self.params.get('source_template_name') source_vdc = self.params.get('source_vdc') source_vapp = self.params.get('source_vapp') source_vapp_resource = None if source_vapp: source_vdc_resource = VDC(self.client, resource=self.org.get_vdc(source_vdc)) source_vapp_resource_href = source_vdc_resource.get_resource_href( name=source_vapp, entity_type=EntityType.VAPP) source_vapp_resource = self.client.get_resource( source_vapp_resource_href) if source_catalog_name: catalog_item = self.org.get_catalog_item(source_catalog_name, source_template_name) source_vapp_resource = self.client.get_resource( catalog_item.Entity.get('href')) return source_vapp_resource
def get_source_resource(self): source_catalog_name = self.params.get('source_catalog_name') source_template_name = self.params.get('source_template_name') source_vdc = self.params.get('source_vdc') source_vapp = self.params.get('source_vapp') org_resource = Org(self.client, resource=self.client.get_org()) source_vapp_resource = None if source_vapp: source_vdc_resource = VDC( self.client, resource=org_resource.get_vdc(source_vdc)) source_vapp_resource_href = source_vdc_resource.get_resource_href( name=source_vapp, entity_type=EntityType.VAPP) source_vapp_resource = self.client.get_resource( source_vapp_resource_href) if source_catalog_name: catalog_item = org_resource.get_catalog_item( source_catalog_name, source_template_name) source_vapp_resource = self.client.get_resource( catalog_item.Entity.get('href')) return source_vapp_resource