pem.getResourceUsageForPeriod

This method is supported by Operations starting from version 2.3.

This method returns usage statistics for Resource Types within the specified Subscription for a given period of time. It is complimentary to the pem.getResourceUsage method.

The method has the following input parameters:

Name

Type

Short Description

subscription_id

int

ID of Subscription. It indicates the Subscription the resource usage is returned for.

resource_type_ids

array of int

IDs of Resource Types in request.

from_time

int

It indicates the start time of the period the resource usage is returned for. Must be specified in the number of seconds since 1970-01-01 00:00:00 UTC (Unix time format).

to_time

int

It indicates the end time of the period the resource usage is returned for. Must be specified in the number of seconds since 1970-01-01 00:00:00 UTC (Unix time format).

The method has the following output parameters:

Name

Type

Short Description

resource_type_usages

array of struct

It contains resource usages for each requested Resource Type.

  • usage_statistics

struct

The usage statistics for Resource Type identified by the resource_type_id parameter.

  • n/a

array of struct

It contains the information on changes of resource's usage.

  • delta

int

It contains the actual change of the resource’s usage. The value of the change may be negative depending on the Resource Type.

  • delta64

bigint

64bit analog of the delta parameter.

  • time

int

It indicates the point in time when the usage of the resource was changed. It is specified in the number of seconds since 1970-01-01 00:00:00 UTC (Unix time format).

  • parent_resource_type_id

int

It indicates the parent Resource Type of the Resource Type the usage statistics is returned for. This value can be used to group usage statistics for related Resource Types.

  • initial_usage

int

It represents the absolute value of resource’s usage at the start of the requested period. The usage is specified in units the Resource Type is measured in.

  • resource_type_id

int

It indicates the Resource Type the usage statistics is returned for.

  • initial_usage64

bigint

64bit analog of the initial_usage parameter.

actual_period

struct

It indicates the actual period the resource usages are returned for. For the description of what the actual period is, see the note below.

  • from_time

int

It indicates the actual start time of the period the resource usages are returned for. It is specified in the number of seconds since 1970-01-01 00:00:00 UTC (Unix time format).

  • to_time

int

It indicates the actual end time of the period the resource usages are returned for. It is specified in the number of seconds since 1970-01-01 00:00:00 UTC (Unix time format).

Note: The caller may request usage statistics for a period of time for which there are no statistics in the system at all or there exist statistics for a part of the requested period only. The actual_period returned parameter serves the purposes to address such situations. Depending on the values of input from_time and to_time parameters and the period of time for which the statistics exist in the system, the actual_period returned parameter can take values described in the table below.

 

from_time in history

&

to_time in history

from_time in history

&

to_time > history_end

from_time > history_end

&

to_time > history_end

actual_period

 

 

 

from_time

from_time

from_time

history_end

to_time

to_time

history_end

history_end

Here "history_end" represents the point time when the given request for statistics is served (current time at callee side). "in history" means point in time that is earlier than "history_end".

See also:

pem.getResourceUsage method.