feat(AWS HTTP API): Deprecate provider.httpApi.useProviderTags

This commit is contained in:
Piotr Grzesik 2021-10-25 11:44:35 +02:00 committed by Mariusz Nowak
parent afc0955093
commit 650ed37db3
3 changed files with 38 additions and 0 deletions

View File

@ -38,6 +38,14 @@ Note:
- The `serverless.yml` setting is ineffective for deprecations reported before the configuration is read.
- `SLS_DEPRECATION_DISABLE` and `disabledDeprecations` remain respected, and no errors will be thrown for mentioned deprecation codes.
<a name="AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY"><div>&nbsp;</div></a>
## Ineffective property `provider.httpApi.useProviderTags`
Deprecation code: `AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY`
Starting with "v3.0.0", property `provider.httpApi.useProviderTags` is no longer effective as provider tags are applied to Http Api Gateway by default. You can safely remove this property from your configuration.
<a name="S3_TRANSFER_ACCELERATION_ON_EXISTING_BUCKET"><div>&nbsp;</div></a>
## Attempt to enable S3 Transfer Acceleration on provided S3 buckets

View File

@ -43,6 +43,17 @@ class HttpApiEvents {
serverless.httpApiEventsPlugin = this;
this.hooks = {
'initialize': () => {
if (
this.serverless.service.provider.name === 'aws' &&
_.get(this.serverless.service.provider.httpApi, 'useProviderTags')
) {
this.serverless._logDeprecation(
'AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY',
'Property "provider.httpApi.useProviderTags" is no longer effective as provider tags are applied to Http Api Gateway by default. You can safely remove this property from your configuration.'
);
}
},
'package:compileEvents': () => {
this.resolveConfiguration();
if (!this.config.routes.size) return;

View File

@ -1188,4 +1188,23 @@ describe('lib/plugins/aws/package/compile/events/httpApi.test.js', () => {
});
});
});
it('should trigger a deprecation when `provider.httpApi.useProviderTags` is set', async () => {
await expect(
runServerless({
fixture: 'httpApi',
configExt: {
provider: {
httpApi: {
useProviderTags: true,
},
},
},
command: 'package',
})
).to.eventually.be.rejected.and.have.property(
'code',
'REJECTED_DEPRECATION_AWS_HTTP_API_USE_PROVIDER_TAGS_PROPERTY'
);
});
});