0

How does one add a method to a resource in AWS API Gateway, using the AWS Powershell module and powershell?

What I have tried so far

This powershell script does not work:

$op = @{Op='add'; Path='/ResourceMethods'; Value='GET'}
Update-AGResource -RestApiId $id  -resourceId $resid `
   -PatchOperation $op -region $region @creds

Amazon documentation on this page, shows an example of the equivalent using the AWS CLI tool ...

aws apigateway put-method --rest-api-id te6si5ach7 \
       --region us-west-2 \
       --resource-id 2jf6xt \
       --http-method ANY \
       --authorization-type "NONE" 

... but I don't want to use the CLI. I want to use powershell instead.

I think the problem might be the Path item of $op. The documentation is not very clear on what the path for methods should be.

Sean B. Durkin
  • 12,659
  • 1
  • 36
  • 65

1 Answers1

1

I've solved it.

Update-AGResource is the wrong cmdlet to add a method. The correct cmdlet is Write-AGMethod.

Sean B. Durkin
  • 12,659
  • 1
  • 36
  • 65