Skip to content

Commit a91bbd4

Browse files
committed
update the README
1 parent 98a695a commit a91bbd4

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,46 @@ functions:
622622
- {}
623623
```
624624

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+
625665
#### `requestModels`
626666

627667
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

Comments
 (0)