Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changelog/a3b1dd91e03f4540b7601093acd4e231.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "a3b1dd91-e03f-4540-b760-1093acd4e231",
"type": "documentation",
"description": "Doc-only update to generate deprecated annotation for services that have been marked as deprecated.",
"modules": [
"service/chime",
"service/sms"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package software.amazon.smithy.aws.go.codegen.customization;

import software.amazon.smithy.go.codegen.GoSettings;
import software.amazon.smithy.go.codegen.integration.GoIntegration;
import software.amazon.smithy.model.Model;
import software.amazon.smithy.model.shapes.Shape;
import software.amazon.smithy.model.traits.DeprecatedTrait;
import software.amazon.smithy.model.transform.ModelTransformer;

import java.util.Set;

/**
* Deprecates an entire service by applying @deprecated to every shape. This will reflect in IDEs and public package
* documentation.
*/
public class DeprecateService implements GoIntegration {
private static final String DEPRECATION_MESSAGE =
"AWS has deprecated this service. It is no longer available for use.";
private static final Set<String> DEPRECATED = Set.of(
);

@Override
public Model preprocessModel(Model model, GoSettings settings) {
var service = settings.getService(model);
if (!DEPRECATED.contains(service.getId().toString())) {
return model;
}

return ModelTransformer.create().mapShapes(model, shape -> {
if (shape.isMemberShape()) {
return shape;
}

var deprecated = DeprecatedTrait.builder()
.message(DEPRECATION_MESSAGE)
.build();
return Shape.shapeToBuilder(shape)
.addTrait(deprecated)
.build();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ software.amazon.smithy.aws.go.codegen.customization.RetryModeUserAgent
software.amazon.smithy.aws.go.codegen.customization.RequestCompressionUserAgent
software.amazon.smithy.aws.go.codegen.customization.s3.ExpressUserAgent
software.amazon.smithy.aws.go.codegen.customization.BackfillRequiredTrait
software.amazon.smithy.aws.go.codegen.customization.DeprecateService
2 changes: 2 additions & 0 deletions service/chime/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions service/sms/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.