-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add preprocessor to rename the KMS service namespace
- Loading branch information
Showing
10 changed files
with
9,015 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Manifest-Version: 1.0 | ||
Licenses: Apache-2.0 (Apache License 2.0) | ||
URL: http://github.com/disneystreaming/aws-sdk-specs | ||
Implementation-Version: 2023.23.30 | ||
Description: Jar containing smithy spec for kms | ||
Implementation-Vendor: com.disneystreaming.smithy | ||
Implementation-Title: aws-kms-spec | ||
Created-By: Mill 0.11.1 | ||
Tool: Mill-0.11.1 | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kms.smithy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": "1.0", | ||
"projections": { | ||
"exampleProjection": { | ||
"transforms": [ | ||
{ | ||
"name": "flattenNamespaces", | ||
"args": { | ||
"namespace": "com.dwolla.amazonaws.kms", | ||
"service": "com.amazonaws.kms#KMS" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...s/src/main/resources/META-INF/services/software.amazon.smithy.build.ProjectionTransformer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.dwolla.smithy.ShadeNamespace |
27 changes: 27 additions & 0 deletions
27
smithy4s-preprocessors/src/main/scala/com/dwolla/smithy/ShadeNamespace.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.dwolla.smithy | ||
|
||
import cats.syntax.all._ | ||
import software.amazon.smithy.build.{ProjectionTransformer, TransformContext} | ||
import software.amazon.smithy.model.Model | ||
import software.amazon.smithy.model.shapes.Shape | ||
|
||
import java.util.stream.Collectors | ||
import scala.collection.JavaConverters._ | ||
|
||
class ShadeNamespace extends ProjectionTransformer { | ||
override def getName: String = "com.dwolla.smithy.ShadeNamespace" | ||
|
||
private val namespacesToRename: Set[String] = Set("com.amazonaws.kms") | ||
|
||
override def transform(context: TransformContext): Model = { | ||
val renames = | ||
context.getModel | ||
.shapes().collect(Collectors.toList[Shape]).asScala.toList | ||
.map(_.getId) | ||
.filter(id => namespacesToRename.contains(id.getNamespace)) | ||
.fproduct(id => id.withNamespace(s"com.dwolla.smithy_shaded.${id.getNamespace}")) | ||
.toMap.asJava | ||
|
||
context.getTransformer.renameShapes(context.getModel, renames) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters