You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -622,6 +622,46 @@ functions:
622
622
- {}
623
623
```
624
624
625
+
##### private
626
+
627
+
If you use the [private](https://www.serverless.com/framework/docs/providers/aws/events/apigateway#setting-api-keys-for-your-rest-api) property on your event:
628
+
629
+
```yml
630
+
functions:
631
+
getData:
632
+
events:
633
+
- http:
634
+
path: /
635
+
method: get
636
+
private: true
637
+
```
638
+
639
+
It will automatically setup an apiKey security scheme of `x-api-key` attached to that method. You don't need to add this to the [Security Scheme](#securityschemes) in the main documentation. If you have already added a Security Scheme of an `apiKey` with a name of `x-api-key`, it will associate with that key.
640
+
641
+
```yml
642
+
custom:
643
+
documentation:
644
+
securitySchemes:
645
+
my_api_key:
646
+
type: apiKey
647
+
name: x-api-key
648
+
in: header
649
+
security:
650
+
- my_api_key: []
651
+
652
+
functions:
653
+
getData:
654
+
events:
655
+
- http:
656
+
path: /
657
+
method: get
658
+
private: true
659
+
documentation:
660
+
...
661
+
```
662
+
663
+
Will set the Security Scheme to `my_api_key` for that operation.
664
+
625
665
#### `requestModels`
626
666
627
667
The `requestModels` property allows you to define models for the HTTP Request of the function event. You can define a different model for each different `Content-Type`. You can define a reference to the relevant request model named in the `models` section of your configuration (see [Defining Models](#models) section).
0 commit comments