@middy/service-discovery 4.0.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -62
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -36,68 +36,6 @@
|
|
|
36
36
|
<p>You can read the documentation at: <a href="https://middy.js.org/docs/middlewares/service-discovery">https://middy.js.org/docs/middlewares/service-discovery</a></p>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
|
-
Fetches Service Discovery instances to be used when connecting to other AWS services.
|
|
40
|
-
|
|
41
|
-
## Install
|
|
42
|
-
|
|
43
|
-
To install this middleware you can use NPM:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npm install --save @middy/service-discovery
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Options
|
|
50
|
-
|
|
51
|
-
- `AwsClient` (object) (default `ServiceDiscoveryClient`): ServiceDiscoveryClient class constructor (i.e. that has been instrumented with AWS XRay). Must be from `@aws-sdk/client-servicediscovery`.
|
|
52
|
-
- `awsClientOptions` (object) (default `undefined`): Options to pass to ServiceDiscoveryClient class constructor.
|
|
53
|
-
- `awsClientAssumeRole` (string) (default `undefined`): Internal key where secrets are stored. See [@middy/sts](/packages/sts/README.md) on to set this.
|
|
54
|
-
- `awsClientCapture` (function) (default `undefined`): Enable XRay by passing `captureAWSClient` from `aws-xray-sdk` in.
|
|
55
|
-
- `fetchData` (object) (required): Mapping of internal key name to API request parameters.
|
|
56
|
-
- `disablePrefetch` (boolean) (default `false`): On cold start requests will trigger early if they can. Setting `awsClientAssumeRole` disables prefetch.
|
|
57
|
-
- `cacheKey` (string) (default `sts`): Cache key for the fetched data responses. Must be unique across all middleware.
|
|
58
|
-
- `cacheExpiry` (number) (default `-1`): How long fetch data responses should be cached for. `-1`: cache forever, `0`: never cache, `n`: cache for n ms.
|
|
59
|
-
- `setToContext` (boolean) (default `false`): Store credentials to `request.context`.
|
|
60
|
-
|
|
61
|
-
NOTES:
|
|
62
|
-
|
|
63
|
-
- Lambda is required to have IAM permission for `servicediscovery:DiscoverInstances`
|
|
64
|
-
|
|
65
|
-
## Sample usage
|
|
66
|
-
|
|
67
|
-
```javascript
|
|
68
|
-
import middy from '@middy/core'
|
|
69
|
-
import serviceDiscovery from '@middy/service-discovery'
|
|
70
|
-
|
|
71
|
-
const handler = middy((event, context) => {
|
|
72
|
-
const response = {
|
|
73
|
-
statusCode: 200,
|
|
74
|
-
headers: {},
|
|
75
|
-
body: JSON.stringify({ message: 'hello world' })
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return response
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
handler.use(
|
|
82
|
-
serviceDiscovery({
|
|
83
|
-
fetchData: {
|
|
84
|
-
instances: {
|
|
85
|
-
NamespaceName: '...',
|
|
86
|
-
ServiceName: '...'
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
)
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Middy documentation and examples
|
|
94
|
-
|
|
95
|
-
For more documentation and examples, refers to the main [Middy monorepo on GitHub](https://github.com/middyjs/middy) or [Middy official website](https://middy.js.org).
|
|
96
|
-
|
|
97
|
-
## Contributing
|
|
98
|
-
|
|
99
|
-
Everyone is very welcome to contribute to this repository. Feel free to [raise issues](https://github.com/middyjs/middy/issues) or to [submit Pull Requests](https://github.com/middyjs/middy/pulls).
|
|
100
|
-
|
|
101
39
|
## License
|
|
102
40
|
|
|
103
41
|
Licensed under [MIT License](LICENSE). Copyright (c) 2017-2022 [Luciano Mammino](https://github.com/lmammino), [will Farrell](https://github.com/willfarrell), and the [Middy team](https://github.com/middyjs/middy/graphs/contributors).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@middy/service-discovery",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Service Discovery (Cloud Map) instances middleware for the middy framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
},
|
|
62
62
|
"homepage": "https://middy.js.org",
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@middy/util": "4.0.
|
|
64
|
+
"@middy/util": "4.0.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@aws-sdk/client-servicediscovery": "^3.186.0",
|
|
68
|
-
"@middy/core": "4.0.
|
|
68
|
+
"@middy/core": "4.0.2",
|
|
69
69
|
"@types/aws-lambda": "^8.10.101",
|
|
70
70
|
"aws-xray-sdk": "^3.3.3"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "c77c9413ecb80999a71b67ff97edac1fed2ca754"
|
|
73
73
|
}
|