BryanMLima opened a new pull request, #8372:
URL: https://github.com/apache/cloudstack/pull/8372

   ### Description
   
   This PR extends the functionality introduced in PR #5909, allowing users to 
list the preset variables via API, facilitating the creation of the activation 
rules while creating tariffs for the Quota plugin.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [x] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   - [ ] build/CI
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [x] Minor
   
   ### How Has This Been Tested?
   
   I tested this PR verifying the preset variables for the Quota usage types. 
Below, are the output for the quota usage type `RUNNING_VMS` with enum 1.
   
   <details><summary>API output</summary>
   
   ```
   (lab) 🐱 > quota presetvariableslist usagetype=1
   {
     "count": 41,
     "variables": [
       {
         "description": "Account owner of the resource.",
         "variable": "account"
       },
       {
         "description": "Role of the account. This field will not exist if the 
account is a project.",
         "variable": "account.role"
       },
       {
         "description": "Role type of the resource's owner.",
         "variable": "account.role.type"
       },
       {
         "description": "ID of the resource.",
         "variable": "account.role.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "account.role.name"
       },
       {
         "description": "ID of the resource.",
         "variable": "account.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "account.name"
       },
       {
         "description": "Domain owner of the resource.",
         "variable": "domain"
       },
       {
         "description": "Path of the domain owner of the resource.",
         "variable": "domain.path"
       },
       {
         "description": "ID of the resource.",
         "variable": "domain.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "domain.name"
       },
       {
         "description": "Project owner of the resource. This field will not 
exist if the resource belongs to an account.",
         "variable": "project"
       },
       {
         "description": "ID of the resource.",
         "variable": "project.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "project.name"
       },
       {
         "description": "Type of the record used. Examples for this are: 
VirtualMachine, DomainRouter, SourceNat, KVM.",
         "variable": "resourceType"
       },
       {
         "description": "Data related to the resource being processed.",
         "variable": "value"
       },
       {
         "description": "ID of the resource.",
         "variable": "value.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "value.name"
       },
       {
         "description": "Host where the VM is running.",
         "variable": "value.host"
       },
       {
         "description": "List of tags of the host where the VM is running 
(i.e.: [\"a\", \"b\"]).",
         "variable": "value.host.tags"
       },
       {
         "description": "Whether the tag is a rule interpreted in JavaScript.",
         "variable": "value.host.isTagARule"
       },
       {
         "description": "ID of the resource.",
         "variable": "value.host.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "value.host.name"
       },
       {
         "description": "OS of the VM/template.",
         "variable": "value.osName"
       },
       {
         "description": "A list of resources of the account between the start 
and end date of the usage record being calculated (i.e.: [{zoneId: ..., 
domainId:...}]).",
         "variable": "value.accountResources"
       },
       {
         "description": "List of tags of the resource in the format key:value 
(i.e.: {\"a\":\"b\", \"c\":\"d\"}).",
         "variable": "value.tags"
       },
       {
         "description": "Computing offering of the VM.",
         "variable": "value.computeOffering"
       },
       {
         "description": "A boolean informing if the compute offering is 
customized or not.",
         "variable": "value.computeOffering.customized"
       },
       {
         "description": "ID of the resource.",
         "variable": "value.computeOffering.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "value.computeOffering.name"
       },
       {
         "description": "Template/ISO with which the VM was created.",
         "variable": "value.template"
       },
       {
         "description": "ID of the resource.",
         "variable": "value.template.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "value.template.name"
       },
       {
         "description": "Computing resources consumed by the VM.",
         "variable": "value.computingResources"
       },
       {
         "description": "Current VM's memory (in MiB).",
         "variable": "value.computingResources.memory"
       },
       {
         "description": "Current VM's vCPUs.",
         "variable": "value.computingResources.cpuNumber"
       },
       {
         "description": "Current VM's CPU speed (in MHz).",
         "variable": "value.computingResources.cpuSpeed"
       },
       {
         "description": "The hypervisor where the resource was deployed. Values 
can be: XenServer, KVM, VMware, Hyperv, BareMetal, Ovm, Ovm3 and LXC.",
         "variable": "value.hypervisorType"
       },
       {
         "description": "Zone where the resource is.",
         "variable": "zone"
       },
       {
         "description": "ID of the resource.",
         "variable": "zone.id"
       },
       {
         "description": "Name of the resource.",
         "variable": "zone.name"
       }
     ]
   }
   ```
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to