Get statistics of the current line

REST: GET /telephony/{billingAccount}/line/{serviceName}/statistics
@param timeframe [required]
@param type [required]
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
321803
public OvhUnitAndValues<OvhTimestampAndValue> billingAccount_line_serviceName_statistics_GET(String billingAccount, String serviceName, OvhStatisticsTimeframeEnum timeframe, OvhLineStatisticsTypeEnum type) throws IOException {
		String qPath = "/telephony/{billingAccount}/line/{serviceName}/statistics";
		StringBuilder sb = path(qPath, billingAccount, serviceName);
		query(sb, "timeframe", timeframe);
		query(sb, "type", type);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t10);
	}
425190
public UserStatListResult getUserStatistic(String startTime, int duration)
            throws APIConnectionException, APIRequestException {
        return _reportClient.getUserStatistic(startTime, duration);
    }
925961
def get_svc_stats(self, svcs):
        
        stats = {
            "services.total": 0,
            "services.ok": 0,
            "services.warning": 0,
            "services.critical": 0,
            "services.unknown": 0,
            "services.flapping": 0,
            "services.in_downtime": 0,
            "services.checked": 0,
            "services.scheduled": 0,
            "services.active_checks": 0,
            "services.passive_checks": 0,
        }
        for svc in svcs:
            if type(svc) is not dict:
                continue

            sane = self._sanitize_entity(svc)
            stats["services.total"] += 1
            stats["services.flapping"] += self._trans_binary(sane["flapping"])
            stats["services.in_downtime"] += self._trans_dtime(
                sane["in_downtime"])
            stats["services.checked"] += self._trans_binary(sane["checked"])
            stats[
                "services.scheduled"] += self._trans_binary(sane["scheduled"])
            stats["services.active_checks"] += sane["active_checks"]
            stats["services.passive_checks"] += sane["passive_checks"]
            state_key = self._trans_svc_state(sane["state"])
            stats["services.%s" % (state_key)] += 1

        return stats
49855
public OvhVoiceConsumption billingAccount_service_serviceName_voiceConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException {
		String qPath = "/telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId}";
		StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhVoiceConsumption.class);
	}
667625
public synchronized TransactionQueueData getStatistics() {
        return new TransactionQueueData(this,
                                        mTimeLapseStart,
                                        System.currentTimeMillis(),
                                        mQueue.size(),
                                        mThreadCount,
                                        mServicingCount,
                                        mPeakQueueSize,
                                        mPeakThreadCount,
                                        mPeakServicingCount,
                                        mTotalEnqueueAttempts,
                                        mTotalEnqueued,
                                        mTotalServiced,
                                        mTotalExpired,
                                        mTotalServiceExceptions,
                                        mTotalUncaughtExceptions,
                                        mTotalQueueDuration,
                                        mTotalServiceDuration);
    }
366326
public OvhOrder telephony_billingAccount_securityDeposit_POST(String billingAccount, OvhSecurityDepositAmountsEnum amount) throws IOException {
		String qPath = "/order/telephony/{billingAccount}/securityDeposit";
		StringBuilder sb = path(qPath, billingAccount);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "amount", amount);
		String resp = exec(qPath, "POST", sb.toString(), o);
		return convertTo(resp, OvhOrder.class);
	}
815293
public OvhOvhPabxMenu billingAccount_ovhPabx_serviceName_menu_menuId_GET(String billingAccount, String serviceName, Long menuId) throws IOException {
		String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}";
		StringBuilder sb = path(qPath, billingAccount, serviceName, menuId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhOvhPabxMenu.class);
	}
555297
public OvhOrder telephony_trunks_serviceName_updateSimultaneousChannels_GET(String serviceName, Long quantity) throws IOException {
		String qPath = "/order/telephony/trunks/{serviceName}/updateSimultaneousChannels";
		StringBuilder sb = path(qPath, serviceName);
		query(sb, "quantity", quantity);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhOrder.class);
	}
897638
public ArrayList<OvhDirectoryWayType> billingAccount_service_serviceName_directory_getWayTypes_GET(String billingAccount, String serviceName) throws IOException {
		String qPath = "/telephony/{billingAccount}/service/{serviceName}/directory/getWayTypes";
		StringBuilder sb = path(qPath, billingAccount, serviceName);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, t14);
	}
955135
@SuppressWarnings("unchecked")
    public static <T> T getService(Class<T> type) {
        Bundle serviceBundle = FrameworkUtil.getBundle(type);
        BundleContext serviceBundleContext = serviceBundle.getBundleContext();
        ServiceReference serviceReference = serviceBundleContext.getServiceReference(type.getName());
        return (T) serviceBundleContext.getService(serviceReference);
    }
479358
public StatisticImpl getStatistic() {
        StatisticImpl aggStat = getSpdDouble().getStatistic();
        aggStat.setLastSampleTime(PmiUtil.currentTime());
        return aggStat;
    }
1183615
public OvhOfferTask billingAccount_service_serviceName_offerTask_taskId_GET(String billingAccount, String serviceName, Long taskId) throws IOException {
		String qPath = "/telephony/{billingAccount}/service/{serviceName}/offerTask/{taskId}";
		StringBuilder sb = path(qPath, billingAccount, serviceName, taskId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhOfferTask.class);
	}
1313852
private Service getServiceInstance(TransientWebServiceRefInfo tInfo, WebServiceRefInfo wsrInfo) throws Exception {
        Class<?> svcSubClass = null;
        Service instance = null;
        if (tInfo.getServiceRefTypeClass() != null && Service.class.getName().equals(tInfo.getServiceRefTypeClassName())) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Creating service instance using generic Service.create(QName)");
            }
            return Service.create(tInfo.getServiceQName());
        }

        if (tInfo.getServiceRefTypeClass() != null && Service.class.isAssignableFrom(tInfo.getServiceRefTypeClass())) {
            svcSubClass = tInfo.getServiceRefTypeClass();
        } else {
            svcSubClass = tInfo.getServiceInterfaceClass();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Attempting to create instance of service sub-class: " + svcSubClass.getName());
        }
        final Class<?> finalSvcSubClass = svcSubClass;
        Constructor<?> constructor = null;

        // first we get the constructor for the service subclass, we will always use
        // the URL, QName constructor because this constructor allow for null arguments
        try {
            final Constructor<?> finalConstructor = (Constructor<?>) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                @Override
                public Object run() throws NoSuchMethodException {
                    return finalSvcSubClass.getDeclaredConstructor(new Class[] { URL.class, QName.class });
                }
            });
            constructor = finalConstructor;
        } catch (PrivilegedActionException e) {
            if (e.getException() != null) {
                throw e.getException();
            } else {
                throw e;
            }
        }

        // now we will create the service instance with the constructor that was
        // previously created, it's okay if the URL we try to obtain turns out
        // to be null, a service instance will be created without the use of
        // the WSDL document we supplied
        final URL url = tInfo.getWsdlURL();

        //jsr-109:
//        For co-located clients (where the client and the server are in the same Java EE application unit) with
//        generated Service class, the location of the final WSDL document is resolved by comparing the Service name
//        on the @WebServiceClient annotation on the the generated Service to the Service names of all the deployed
//        port components in the Java EE application unit

        // Future plan need to consider:
//        if it is a co-located clients, need to verify the defined wsdlLocation and make it use the dynamic one
//        if there is no wsdlLocation defined, need to use the dynamic one
//        need to consider in the ear level
//        need to consider virtual host

        if (url == null)
        {
            JaxWsModuleMetaData jaxwsModuleMetaData = tInfo.getClientMetaData().getModuleMetaData();
            String applicationName = jaxwsModuleMetaData.getJ2EEName().getApplication();
            String contextRoot = jaxwsModuleMetaData.getContextRoot();
            Map<String, String> appNameURLMap = jaxwsModuleMetaData.getAppNameURLMap();
            Container moduleContainer = jaxwsModuleMetaData.getModuleContainer();
            NonPersistentCache overlayCache;
            try {
                overlayCache = moduleContainer.adapt(NonPersistentCache.class);
                JaxWsModuleInfo jaxWsModuleInfo = (JaxWsModuleInfo) overlayCache.getFromCache(JaxWsModuleInfo.class);
                if (jaxWsModuleInfo != null) {
                    for (EndpointInfo endpointInfo : jaxWsModuleInfo.getEndpointInfos()) {
                        String address = endpointInfo.getAddress(0).substring(1);
                        String serviceName = wsrInfo.getServiceQName().getLocalPart();
                        if (serviceName.equals(address))
                        {
                            String wsdlLocation = null;
                            if ((appNameURLMap != null) && (!appNameURLMap.isEmpty())) {
                                String applicationURL = appNameURLMap.get(applicationName);
                                wsdlLocation = applicationURL + "/" + address + "?wsdl";
                            } else {
                                wsdlLocation = getWsdlUrl() + contextRoot + "/" + address + "?wsdl";
                            }

                            final URL newURl = new URL(wsdlLocation);
                            wsrInfo.setWsdlLocation(wsdlLocation);

                            try {
                                final Constructor<?> finalConstructor = constructor;
                                final QName serviceQName = tInfo.getServiceQName();
                                instance = (Service) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                                    @Override
                                    public Object run() throws InstantiationException, IllegalAccessException, InvocationTargetException {
                                        finalConstructor.setAccessible(true);
                                        return finalConstructor.newInstance(new Object[] { newURl, serviceQName });
                                    }
                                });
                            } catch (PrivilegedActionException e) {
                                if (e.getException() != null) {
                                    throw e.getException();
                                } else {
                                    throw e;
                                }
                            }
                            break;

                        }

                    }
                }
            } catch (UnableToAdaptException e) {

            }
        }
        if (instance != null)
        {
            return instance;
        }

        if (url != null) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Creating Service with WSDL URL: " + url + " and QName: " + tInfo.getServiceQName() + " for class: " + svcSubClass.getName());
            }
        }
        try {
            final Constructor<?> finalConstructor = constructor;
            final QName serviceQName = tInfo.getServiceQName();
            instance = (Service) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                @Override
                public Object run() throws InstantiationException, IllegalAccessException, InvocationTargetException {
                    finalConstructor.setAccessible(true);
                    return finalConstructor.newInstance(new Object[] { url, serviceQName });
                }
            });
        } catch (PrivilegedActionException e) {
            if (e.getException() != null) {
                throw e.getException();
            } else {
                throw e;
            }
        }

        return instance;
    }
589516
public void billingAccount_line_serviceName_phone_PUT(String billingAccount, String serviceName, OvhPhone body) throws IOException {
		String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone";
		StringBuilder sb = path(qPath, billingAccount, serviceName);
		exec(qPath, "PUT", sb.toString(), body);
	}
651112
def _get_bucket_statistics(self, bucket_name, bucket_region, storage_type, statistic, days):
        

        cw = self.session.client('cloudwatch', region_name=bucket_region)

        # gather cw stats

        try:
            obj_stats = cw.get_metric_statistics(
                Namespace='AWS/S3',
                MetricName=statistic,
                Dimensions=[
                    {
                        'Name': 'StorageType',
                        'Value': storage_type
                    },
                    {
                        'Name': 'BucketName',
                        'Value': bucket_name
                    }
                ],
                Period=86400,
                StartTime=datetime.utcnow() - timedelta(days=days),
                EndTime=datetime.utcnow(),
                Statistics=[
                    'Average'
                ]
            )
            stat_value = obj_stats['Datapoints'][0]['Average'] if obj_stats['Datapoints'] else 'NO_DATA'

            return stat_value

        except Exception as e:
            self.log.error(
                'Could not get bucket statistic for account {} / bucket {} / {}'.format(self.account.account_name,
                                                                                        bucket_name, e))

        finally:
            del cw
651994
private double getLogDiscountFactorForDiscounting(double time) {
		return discountCurveForDiscountRate == null ? -discountRate * time : Math.log(discountCurveForDiscountRate.getDiscountFactor(null, time));
	}
111348
public static gslbservice_stats get(nitro_service service, String servicename) throws Exception{
		gslbservice_stats obj = new gslbservice_stats();
		obj.set_servicename(servicename);
		gslbservice_stats response = (gslbservice_stats) obj.stat_resource(service);
		return response;
	}