Download all ad units.

  Args:
    inventory_service: An instance of the InventoryService.

  Returns:
    A list containing all ad units.
185566
def get_all_ad_units(inventory_service):
  
  # Create a statement to get all ad units.
  statement = (ad_manager.StatementBuilder(version='v201811')
               .OrderBy('id', ascending=True))

  # Pull down all ad units into a list
  keep_iterating = True
  total_results = 0
  found_ad_units = []
  while keep_iterating:
    page = inventory_service.getAdUnitsByStatement(statement.ToStatement())
    if 'results' in page and len(page['results']):
      total_results = page['totalResultSetSize']
      found_ad_units.extend(page['results'])

    statement.offset += statement.limit
    keep_iterating = statement.offset < total_results

  return found_ad_units
649566
def _get_services(self, full_objects=False):
        
        bsc = api.get_tool("bika_setup_catalog")
        brains = bsc(portal_type="AnalysisService")
        if full_objects:
            return map(api.get_object, brains)
        return brains
580184
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
      throws RemoteException {
    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        adManagerServices.get(session, InventoryServiceInterface.class);

    // Create a statement to select all ad unit sizes.
    StatementBuilder statementBuilder = new StatementBuilder();

    // Get all ad unit sizes.
    AdUnitSize[] adUnitSizes =
        inventoryService.getAdUnitSizesByStatement(statementBuilder.toStatement());

    if (adUnitSizes != null) {
      for (int i = 0; i < adUnitSizes.length; i++) {
        AdUnitSize adUnitSize = adUnitSizes[i];
        System.out.printf(
            "%d) Ad unit size of dimensions '%s' was found.%n",
            i, adUnitSize.getFullDisplayString());
      }
    } else {
      System.out.println("No ad unit sizes found.");
    }
  }
733422
def services(self):
        
        self._services = []
        params = {"f": "json"}
        if not self._url.endswith('/services'):
            uURL = self._url + "/services"
        else:
            uURL = self._url
        res = self._get(url=uURL, param_dict=params,
                           securityHandler=self._securityHandler,
                           proxy_port=self._proxy_port,
                           proxy_url=self._proxy_url)
        for k, v in res.items():
            if k == "foldersDetail":
                for item in v:
                    if 'isDefault' in item and item['isDefault'] == False:
                        fURL = self._url + "/services/" + item['folderName']
                        resFolder = self._get(url=fURL, param_dict=params,
                                                 securityHandler=self._securityHandler,
                                                 proxy_port=self._proxy_port,
                                                 proxy_url=self._proxy_url)
                        for k1, v1 in resFolder.items():
                            if k1 == "services":
                                self._checkservice(k1,v1,fURL)
            elif k == "services":
                self._checkservice(k,v,uURL)
        return self._services
95463
def inventory(host, port, time, report_every_n_tags, antennas, tx_power,
              tari, session, mode_identifier,
              tag_population, reconnect, tag_filter_mask,
              impinj_extended_configuration,
              impinj_search_mode, impinj_reports, impinj_fixed_freq):
    """"""
    # XXX band-aid hack to provide many args to _inventory.main
    Args = namedtuple('Args', ['host', 'port', 'time', 'every_n', 'antennas',
                               'tx_power', 'tari', 'session',
                               'population', 'mode_identifier',
                               'reconnect', 'tag_filter_mask',
                               'impinj_extended_configuration',
                               'impinj_search_mode',
                               'impinj_reports',
                               'impinj_fixed_freq'])
    args = Args(host=host, port=port, time=time, every_n=report_every_n_tags,
                antennas=antennas, tx_power=tx_power,
                tari=tari, session=session, population=tag_population,
                mode_identifier=mode_identifier,
                reconnect=reconnect, tag_filter_mask=tag_filter_mask,
                impinj_extended_configuration=impinj_extended_configuration,
                impinj_search_mode=impinj_search_mode,
                impinj_reports=impinj_reports,
                impinj_fixed_freq=impinj_fixed_freq)
    logger.debug('inventory args: %s', args)
    _inventory.main(args)
1288483
def services(self):
        
        self._services = []
        params = {
                    "f" : "json"
                }
        json_dict = self._get(url=self._currentURL,
                                 param_dict=params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        if "services" in json_dict.keys():
            for s in json_dict['services']:
                uURL = self._currentURL + "/%s.%s" % (s['serviceName'], s['type'])
                self._services.append(
                    AGSService(url=uURL,
                               securityHandler=self._securityHandler,
                               proxy_url=self._proxy_url,
                               proxy_port=self._proxy_port)
                )
        return self._services
86181
def list_services(self):
        
        services = list(self.services.keys())
        services.sort()
        return services
87433
def load_inventory_from_cache(self):
        '''  '''

        cache = open(self.cache_path_cache, 'r')
        json_inventory = cache.read()
        self.inventory = json.loads(json_inventory)
355461
public List<V> getAllServices(){
        if(cache == null || cache.size() == 0){
            return Collections.emptyList();
        }

        List<V> list = new ArrayList<V>();
        for(V svc : cache.values()){
            list.add(svc);
        }
        return list;
    }
207707
async def _load_all(self):
        '''
        
        '''
        to_delete = []
        for iden, val in self._hivedict.items():
            try:
                appt = _Appt.unpack(val)
                if appt.iden != iden:
                    raise s_exc.InconsistentStorage(mesg='iden inconsistency')
                self._addappt(iden, appt)
                self._next_indx = max(self._next_indx, appt.indx + 1)
            except (s_exc.InconsistentStorage, s_exc.BadStorageVersion, s_exc.BadTime, TypeError, KeyError,
                    UnicodeDecodeError) as e:
                logger.warning('Invalid appointment %r found in storage: %r.  Removing.', iden, e)
                to_delete.append(iden)
                continue

        for iden in to_delete:
            await self._hivedict.pop(iden)

        # Make sure we don't assign the same index to 2 appointments
        if self.appts:
            maxindx = max(appt.indx for appt in self.appts.values())
            self._next_indx = maxindx + 1
1055379
function (bid) {
    return !!(bid && bid.params && bid.params.adCode && bid.params.supplyCode);
  }
922501
def get_all_units(self, params=None):
        
        if not params:
            params = {}
        return self._iterate_through_pages(self.get_units_per_page, resource=UNITS, **{'params': params})
454284
def get_services(self):
        
        self.__load_System_class()
        pid = self.get_pid()
        return [d for d in System.get_active_services() if d.ProcessId == pid]
280949
def get_bucket_inventory(client, bucket, inventory_id):
    """"""
    inventories = client.list_bucket_inventory_configurations(
        Bucket=bucket).get('InventoryConfigurationList', [])
    inventories = {i['Id']: i for i in inventories}
    found = fnmatch.filter(inventories, inventory_id)
    if not found:
        return None

    i = inventories[found.pop()]
    s3_info = i['Destination']['S3BucketDestination']
    return {'bucket': s3_info['Bucket'].rsplit(':')[-1],
            'prefix': "%s/%s/%s" % (s3_info['Prefix'], bucket, i['Id'])}
355578
def list_licenses(service_instance=None):
    '''
    
    '''
    log.trace('Retrieving all licenses')
    licenses = salt.utils.vmware.get_licenses(service_instance)
    ret_dict = [{'key': l.licenseKey,
                 'name': l.name,
                 'description': l.labels[0].value if l.labels else None,
                 # VMware handles unlimited capacity as 0
                 'capacity': l.total if l.total > 0 else sys.maxsize,
                 'used': l.used if l.used else 0}
                 for l in licenses]
    return ret_dict
190011
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
      throws RemoteException {
    // Get the InventoryService.
    InventoryServiceInterface inventoryService =
        adManagerServices.get(session, InventoryServiceInterface.class);

    // Get the NetworkService.
    NetworkServiceInterface networkService =
        adManagerServices.get(session, NetworkServiceInterface.class);

    // Get the effective root ad unit.
    String rootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

    // Create a statement to select only the root ad unit by ID.
    StatementBuilder statementBuilder =
        new StatementBuilder()
            .where("id = :id")
            .orderBy("id ASC")
            .limit(1)
            .withBindVariableValue("id", rootAdUnitId);

    AdUnitPage page = inventoryService.getAdUnitsByStatement(statementBuilder.toStatement());

    AdUnit effectiveRootAdUnit = Iterables.getOnlyElement(Arrays.asList(page.getResults()));

    // Get all ad units.
    List<AdUnit> adUnits = getAllAdUnits(adManagerServices, session);

    buildAndDisplayAdUnitTree(effectiveRootAdUnit, adUnits);
  }
4089
def get_service_list(self) -> list:
        
        # Initialising empty list
        services = []

        # Raise an exception if we are not a manager
        if not self._manager:
            raise RuntimeError('Only the Swarm manager node can retrieve'
                               ' all the services.')

        service_list = self._client.services.list()
        for s_list in service_list:
            services.append(s_list.short_id)
        return services