create_charge_plan

Creates a charge plan for Chargeback based on the definition specified in a JSON file. A charge plan can include multiple entity types, universal rate adjustment factors, and recovery cost settings.

Format

emcli create_charge_plan
    -input_file="json_file:filename"

Options

The required -input_file option specifies the JSON file containing the charge plan definition. Use json_file as the file argument name and replace filename with the path to the file on the EM CLI client.

The file must contain exactly one charge plan object with at least one entity type. The root must be a JSON object, not an array or a wrapper containing multiple plans. Field names are case-sensitive. Unknown fields and duplicate JSON property names are rejected.

The following properties can be defined in the file:

  • planName

    Name of the new charge plan. This property is required. The name must be a nonempty string and must not match the name of an existing charge plan.

  • peakTimeWindow

    Name of an existing peak time window. If this property is not specified, the global peak time window is used. An unrecognized name produces a warning, and the global peak time window is used.

  • startDate

    Start date in DDMMYYYY format. The date must be a report-cycle start date. If this property is not specified, the start date of the current report cycle is used. Dates before the current report cycle are not allowed.

  • entityTypeList

    Nonempty array of entity type definitions. This property is required.

Each entry in entityTypeList supports the following properties:

  • entityType

    Chargeback entity type, such as host or oracle_database. This property is required. Use list_chargeback_entity_types to list supported types.

  • universalRateAdjustment

    Object containing adjustment factors for the entity type's configured universal CPU, memory, and storage charge items. This property is optional.

  • recoveryCost

    Object containing recovery cost settings for the entity type. This property is optional.

The universalRateAdjustment object supports the following optional numeric properties:

  • cpuRateFactor

    Multiplier for the universal CPU charge rate.

  • memoryRateFactor

    Multiplier for the universal memory charge rate.

  • storageRateFactor

    Multiplier for the universal storage charge rate.

A factor of 1.0 uses the universal rate without adjustment; 2.0 doubles that rate.

If universalRateAdjustment is omitted, or none of its factors is specified, the plan uses a factor of 1.0 for each configured universal CPU, memory, and storage item. If at least one factor is specified, only the explicitly specified factors are added. A factor specified for a charge item that is not configured for the entity type produces a warning, and that factor is skipped.

The recoveryCost object supports the following optional numeric properties:

  • recoveryRate

    Recovery rate for the entity type.

  • recoveryPeriod

    Recovery period for the entity type.

  • estimatedInstances

    Estimated number of instances used for recovery cost settings.

Examples

Example 1

This example creates a charge plan named HostPlan for the host entity type. The plan uses the global peak time window, the current report-cycle start date, and a factor of 1.0 for each configured universal charge item:

emcli create_charge_plan -input_file="json_file:/home/plan.json"

Contents of /home/plan.json:

{
  "planName": "HostPlan",
  "entityTypeList": [
    {
      "entityType": "host"
    }
  ]
}

On successful creation, the following message is displayed:

Charge Plan creation succeeded for "HostPlan".

Example 2

This example creates a charge plan named DBPlan for the oracle_database entity type with universal rate adjustment factors and recovery cost settings:

emcli create_charge_plan -input_file="json_file:/home/db_plan.json"

Contents of /home/db_plan.json:

{
  "planName": "DBPlan",
  "peakTimeWindow": "Global",
  "entityTypeList": [
    {
      "entityType": "oracle_database",
      "universalRateAdjustment": {
        "cpuRateFactor": 2.10,
        "memoryRateFactor": 1.00,
        "storageRateFactor": 2.00
      },
      "recoveryCost": {
        "recoveryRate": 0.20,
        "recoveryPeriod": 10,
        "estimatedInstances": 3
      }
    }
  ]
}

To view the charge plan details, use list_charge_plans:

emcli list_charge_plans -charge_plan="DBPlan"

Use the -all option with list_charge_plans to include plans scheduled for a future report cycle.