简体   繁体   中英

Cannot use the listGroupResources in AWS SDK

I want to find the RDS instances in my dev resource group, I have the following code:


  const params = {
    GroupName : "dev",
    Filters : [
      {
        Name : "resource-type",
        Values : ["AWS:RDS:DBInstance"]
      }
    ]
  }

  resourcegroups.listGroupResources(params)

But get this:

(node:69536) UnhandledPromiseRejectionWarning: BadRequestException: 1 validation error detected: Value '[AWS:RDS:DBInstance]' at 'filters.1.member.values' failed to satisfy constraint: Member must satisfy constraint: [Member must have length less than or equal to 128, Member must have length greater than or equal to 1, Member must satisfy regular expression pattern: AWS::[a-zA-Z0-9]+::[a-zA-Z0-9]+]
    at Object.extractError (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/protocol/json.js:51:27)
    at Request.extractError (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/protocol/rest_json.js:55:8)
    at Request.callListeners (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/request.js:688:14)
    at Request.transition (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/dfutschik/ziel/ziel-derrops/node_modules/aws-sdk/lib/request.js:690:12)
(node:69536) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:69536) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Ok that was dumb should be Values: ["AWS::RDS::DBInstance"] with :: instead of :

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM