VMware Tanzu CloudHealth

Run API Commands from Your Browser with GraphQL Explorer

We have exciting news at VMware Aria Cost powered by CloudHealth!  

If you are a user who prefers to interact with VMware Aria Cost programmatically through GraphQL APIs, you can now access the Explorer directly from your browser! Here you can write and test your GraphQL queries on live data in your tenant without installing a separate GraphQL client and managing your access token manually.  

With this enhancement users can benefit with:   

  • No tokens for switching Organizations or general authentication after logging into the platform 
  • Full schema in-line documentation 

What’s New

This feature can be found under “Setup > Admin” menu. The full schema documentation is available right within the Explorer so that you don’t have to flip between tabs! Queries will run in the context of your current organization. Instead of getting a new access token for a different organization within the API, you can switch organizations right from the UI. 

You can send two kinds of calls in GraphQL: 

  • Query: Retrieves data from a source without making any modification to the data. Queries are equivalent to a REST API GET request. 
  • Mutation: Creates, modifies, or deletes data from a source. Mutations are equivalent to a REST API POST, PUT, or DELETE request. 

Permissions for this page will be automatically applied to Admin and Power User role documents. Custom role documents will need to add the permission GraphQL API Explorer. 

Example Queries

Here are a few example queries you can test out:  

Cost Anomalies Summary 

{ 
  costAnomalySummary (filterRules: [ 
    { 
      field: “cloud”, 
      filterType: EQ, 
      filterValues: [ 
        “aws” 
      ] 
    }, 
    { 
      field: “status”, 
      filterType: EQ, 
      filterValues: [ 
        “active” 
      ] 
    }, 
    { 
      field: “timePeriod”, 
      filterType: GT, 
      filterValues: [ 
      “LAST_90” 
      ] 
    } 
    ]) {
        cost
        costImpact
        costImpactPercentage
        count
        activeCount
        inactiveCount
        updatedAt
    }
}

Run this to retrieve information about all your cost anomalies, filterable by cloud, status, and duration. See here for the query arguments and fields to use, or search CostAnomaly in the in-line documentation in the GraphQL API Explorer. 

EBS Volume Rightsizing Recommendations 

query rightsizingRecommendations($requestInput: RightsizingRecommendationRequestInput!, $after: String, $first: Int, $sortRules: [SortRule!]) {
  rightsizingRecommendations(
    requestInput: $requestInput
    after: $after
    first: $first
    sortRules: $sortRules
  ) {
    edges {
      node {
        targetAsset {
          ... on EBSVolume {
            id
            volumeId
            name
            awsInstanceIds
            volumeType
            provisionedThroughput
            throughputUnit
            provisionedIOPS
            provisionedStorageInGB
            __typename
          }
          __typename
        }
        currentMetrics {
          metricName
          aggregation
          value
          status
          __typename
        }
        currentUtilizationStatus
        options {
          ... on EBSVolumeRecommendedOption {
            bestFit
            projectedMonthlyPrice
            name
            provisionedThroughput
            throughputUnit
            provisionedIOPS
            provisionedStorageInGB
            __typename
          }
          __typename
        }
        currentMonthlyPrice
        projectedMonthlyPrice
        projectedMonthlySavings
        terminateRecommendation
        __typename
      }
      __typename
    }
    utilizationStatusSummary {
      underTarget
      goodFit
      overTarget
      unknown
      notEnoughData
      undeterminedFit
      __typename
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
      __typename
    }
    totalCount
    __typename
  }
} 
Input Variable
{
  "assetType": "AWS_EBS",
  "efficiencyTarget": "crn:0:rightsizing/AWS_EBS_EfficiencyTarget:system_avg",
  "evaluationDuration": "LAST_7_DAYS",
  "returnAllInstances": false
}

Run this to get a list of recommendations for our new EBS Volume Rightsizing feature! See here for query fields for EBS volume rightsizing, or search EBSRightsizingSummary from within the GraphQL API Explorer in-line documentation. 

Helpful keyboard shortcuts: 

  • Prettify query:  Shift-Ctrl-P (or press the prettify button) 
  • Merge fragments:  Shift-Ctrl-M (or press the merge button) 
  • Run Query:  Ctrl-Enter (or press the play button) 
  • Auto Complete:  Ctrl-Space (or just start typing) 

Next Steps

For more information on GraphQL Explorer, including query and mutation basics and sample queries, login to VMware Aria Cost and see the Help Center here and for more information about VMware Aria Cost powered by CloudHealth, read our solution brief.