thousandeyes-sdk-python/thousandeyes-sdk-usage/docs/UsageApi.md
2024-09-25 12:41:31 +00:00

15 KiB

thousandeyes_sdk.usage.UsageApi

All URIs are relative to https://api.thousandeyes.com/v7

Method HTTP request Description
get_enterprise_agents_units_usage GET /usage/units/enterprise-agents Get enterprise agent usage
get_tests_units_usage GET /usage/units/tests Get cloud and enterprise agents units usage
get_usage GET /usage Get usage information for the last month

get_enterprise_agents_units_usage

EnterpriseAgentsUsage get_enterprise_agents_units_usage(start_date=start_date, end_date=end_date, cursor=cursor)

Get enterprise agent usage

This operation returns the organization's enterprise agents usage for a specific time period, or the curent billing cycle if no time period is specified. In the /v7/usage API, a shared enterprise agent's usage is reported in the account group where the agent was created (i.e Primary Account Group). However in this API, the shared agent's usage is distributed among all the account groups where the tests are running on the particular agent. This API is also only available to customers on usage based pricing model.

Example

  • Bearer Authentication (BearerAuth):
import thousandeyes_sdk.usage
from thousandeyes_sdk.usage.models.enterprise_agents_usage import EnterpriseAgentsUsage
from thousandeyes_sdk.usage.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
# See configuration.py for a list of all supported configuration parameters.
configuration = thousandeyes_sdk.core.Configuration(
    host = "https://api.thousandeyes.com/v7"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = thousandeyes_sdk.core.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with thousandeyes_sdk.usage.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = thousandeyes_sdk.usage.UsageApi(api_client)
    start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
    end_date = '2022-07-18T22:00:54Z' # datetime | Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
    cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional)

    try:
        # Get enterprise agent usage
        api_response = api_instance.get_enterprise_agents_units_usage(start_date=start_date, end_date=end_date, cursor=cursor)
        print("The response of UsageApi->get_enterprise_agents_units_usage:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UsageApi->get_enterprise_agents_units_usage: %s\n" % e)

Parameters

Name Type Description Notes
start_date datetime Use with the `endDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. [optional]
end_date datetime Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. [optional]
cursor str (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. [optional]

Return type

EnterpriseAgentsUsage

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_tests_units_usage

TestsUsage get_tests_units_usage(aid=aid, start_date=start_date, end_date=end_date, cursor=cursor)

Get cloud and enterprise agents units usage

This operation returns the cloud and enterprise agents usage for all the tests for a specific time period, or the curent billing cycle if no time period is specified. In the /v7/usage API, an enterprise agent's usage is reported in the account group where the agent was created (i.e Primary Account Group). However in this API, the agent's usage is distributed among all the account groups where the tests are running on the particular agent. This API is also only available to customers on usage based pricing model.

Example

  • Bearer Authentication (BearerAuth):
import thousandeyes_sdk.usage
from thousandeyes_sdk.usage.models.tests_usage import TestsUsage
from thousandeyes_sdk.usage.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
# See configuration.py for a list of all supported configuration parameters.
configuration = thousandeyes_sdk.core.Configuration(
    host = "https://api.thousandeyes.com/v7"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = thousandeyes_sdk.core.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with thousandeyes_sdk.usage.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = thousandeyes_sdk.usage.UsageApi(api_client)
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)
    start_date = '2022-07-17T22:00:54Z' # datetime | Use with the `endDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
    end_date = '2022-07-18T22:00:54Z' # datetime | Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. (optional)
    cursor = 'cursor_example' # str | (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. (optional)

    try:
        # Get cloud and enterprise agents units usage
        api_response = api_instance.get_tests_units_usage(aid=aid, start_date=start_date, end_date=end_date, cursor=cursor)
        print("The response of UsageApi->get_tests_units_usage:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UsageApi->get_tests_units_usage: %s\n" % e)

Parameters

Name Type Description Notes
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]
start_date datetime Use with the `endDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. [optional]
end_date datetime Defaults to current time the request is made. Use with the `startDate` parameter. Include the complete time (hours, minutes, and seconds) in UTC time zone, following the ISO 8601 date-time format. See the example for reference. Please note that this parameter can't be used with `window`. [optional]
cursor str (Optional) Opaque cursor used for pagination. Clients should use `next` value from `_links` instead of this parameter. [optional]

Return type

TestsUsage

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_usage

Usage get_usage(aid=aid, expand=expand)

Get usage information for the last month

This operation returns usage for the current period. It provides visibility across all account groups within an organization. To access this endpoint, you need the View Billing permission (a management permission). If you have access to view billing in multiple organizations, query the endpoint using an aid querystring parameter (see optional parameters, below) from each organization. Note: Access to billing information older than one month is not supported by this endpoint.

Example

  • Bearer Authentication (BearerAuth):
import thousandeyes_sdk.usage
from thousandeyes_sdk.usage.models.expand_usage_options import ExpandUsageOptions
from thousandeyes_sdk.usage.models.usage import Usage
from thousandeyes_sdk.usage.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.thousandeyes.com/v7
# See configuration.py for a list of all supported configuration parameters.
configuration = thousandeyes_sdk.core.Configuration(
    host = "https://api.thousandeyes.com/v7"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: BearerAuth
configuration = thousandeyes_sdk.core.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with thousandeyes_sdk.usage.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = thousandeyes_sdk.usage.UsageApi(api_client)
    aid = '1234' # str | A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. (optional)
    expand = [thousandeyes_sdk.usage.ExpandUsageOptions()] # List[ExpandUsageOptions] | Expands the available resources. By default, no expansion takes place if the  `expand` query parameter is not passed. For example, to expand the \"tests\"  resource, pass the query '?expand=test'. (optional)

    try:
        # Get usage information for the last month
        api_response = api_instance.get_usage(aid=aid, expand=expand)
        print("The response of UsageApi->get_usage:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UsageApi->get_usage: %s\n" % e)

Parameters

Name Type Description Notes
aid str A unique identifier associated with your account group. You can retrieve your `AccountGroupId` from the `/account-groups` endpoint. Note that you must be assigned to the target account group. Specifying this parameter without being assigned to the target account group will result in an error response. [optional]
expand **List[ExpandUsageOptions]** Expands the available resources. By default, no expansion takes place if the `expand` query parameter is not passed. For example, to expand the "tests" resource, pass the query '?expand=test'. [optional]

Return type

Usage

Authorization

BearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/hal+json, application/json, application/problem+json

HTTP response details

Status code Description Response headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Insufficient permissions to query endpoint -
404 Not found -
429 Exhausted rate limit for the organization -
500 Internal server error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]