phoenixnap.bmc.rated_usage_info (1.17.0) — module

Retrieves all rated usage for given time period.

| "added in version" 1.15.0 of phoenixnap.bmc"

Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com>

preview | supported by certified

Install collection

Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0


Add to requirements.yml

  collections:
    - name: phoenixnap.bmc
      version: 1.17.0

Description

Gather Retrieves all rated usage for given time period.

This module has a dependency on requests

API is documented at U(https://developers.phoenixnap.com/docs/bmc-billing/1/routes/rated-usage/get).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret'
# in location: ~/.pnap/config.yaml

- name: Retrieves all rated usage
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Retrieves all rated usage for given time period.
      phoenixnap.bmc.rated_usage_info:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        from_year_month: 2023-05
        to_year_month: 2023-10
      register: output
    - name: Print the gathered infos
      ansible.builtin.debug:
        var: output.rated_usage
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Retrieves all rated usage for the current calendar month.
  hosts: localhost
  gather_facts: false
  vars_files:
    - ~/.pnap/config.yaml
  tasks:
    - name: Retrieves all rated usage for the current calendar month.
      phoenixnap.bmc.rated_usage_info:
        client_id: "{{ clientId }}"
        client_secret: "{{ clientSecret }}"
        month_to_date: true
      register: output
    - name: Print the gathered infos
      ansible.builtin.debug:
        var: output.rated_usage

Inputs

    
client_id:
    description: Client ID (Application Management)
    type: str

client_secret:
    description: Client Secret (Application Management)
    type: str

month_to_date:
    default: false
    description: Retrieves all rated usage for the current calendar month if true.
    type: bool

to_year_month:
    description: To year month (inclusive) to filter rated usage records by.
    type: str

from_year_month:
    description: From year month (inclusive) to filter rated usage records by.
    type: str

product_category:
    description: The product category.
    type: str

Outputs

rated_usage:
  contains:
    active:
      description: A flag indicating whether the rated usage record is still active.
      returned: always
      sample: true
      type: bool
    correlationId:
      description: Holds usage record id
      returned: always
      sample: ec4a9d49-1cef-49e9-b85e-b560f88bcd26
      type: str
    cost:
      description: The rated usage in cents.
      returned: always
      sample: 384
      type: int
    costBeforeDiscount:
      description: The cost in cents before discount.
      returned: always
      sample: 15456
      type: int
    costDescription:
      description: The rated usage cost description.
      returned: always
      sample: 24 Hour(s) @ $0.16 /Hour
      type: str
    endDateTime:
      description: The point in time (in UTC) until usage has been rated.
      returned: always
      type: str
    id:
      description: The unique identifier of the rated usage record.
      returned: always
      sample: ec4a9d49-1cef-49e9-b85e-b560f88bcd26
      type: str
    location:
      description: The location code.
      returned: always
      sample: PHX
      type: str
    priceModel:
      description: The price model applied to this usage record.
      returned: always
      sample: hourly
      type: str
    productCategory:
      description: The category of the product associated with this usage record.
      returned: always
      sample: bmc-server
      type: str
    productCode:
      description: The code identifying the product associated to this usage record.
      returned: always
      sample: s1.c1.small
      type: str
    quantity:
      description: The number of units being charged.
      returned: always
      sample: 24
      type: str
    reservationId:
      description: Reservation id associated with this rated usage record.
      returned: always
      sample: c32a24a1-5949-4b60-99c0-c8aaa3a92b04
      type: str
    startDateTime:
      description: The point in time (in UTC) when usage has started.
      returned: always
      type: str
    unitPrice:
      description: The unit price.
      returned: always
      sample: 0.16
      type: str
    unitPriceDescription:
      description: User friendly description of the unit price.
      returned: always
      sample: per hour
      type: str
    usageSessionId:
      description:
      - The usage session ID is used to correlate rated usage records across periods
        of time.
      - For example, a server used for over a month will generate multiple rated usage
        records.
      - The entire usage session cost can be computed by aggregating the records having
        the same usage session ID.
      - It is usual to have one rated usage record per month or invoice.
      returned: always
      sample: ec4a9d49-1cef-49e9-b85e-b560f88bcd26
      type: str
    yearMonth:
      description: Year and month of the usage record.
      returned: always
      sample: 2020-03
      type: str
  description: List of all the rated usage records for given period of months.
  returned: success
  type: list