-
Notifications
You must be signed in to change notification settings - Fork 639
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add SDK-specific feature tracking (#2682)
- Loading branch information
Showing
16,248 changed files
with
106,015 additions
and
31,332 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
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,9 @@ | ||
{ | ||
"id": "a048e0bc-5088-4e76-a29c-9524e4ee34eb", | ||
"type": "feature", | ||
"collapse": true, | ||
"description": "Add framework for tracking specific features in user-agent string.", | ||
"modules": [ | ||
"." | ||
] | ||
} |
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
63 changes: 63 additions & 0 deletions
63
...egen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/AwsPaginators.java
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,63 @@ | ||
/* | ||
* Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.smithy.aws.go.codegen.customization; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import software.amazon.smithy.aws.go.codegen.AwsGoDependency; | ||
import software.amazon.smithy.codegen.core.Symbol; | ||
import software.amazon.smithy.codegen.core.SymbolProvider; | ||
import software.amazon.smithy.go.codegen.GoDelegator; | ||
import software.amazon.smithy.go.codegen.GoSettings; | ||
import software.amazon.smithy.go.codegen.SmithyGoDependency; | ||
import software.amazon.smithy.go.codegen.integration.Paginators; | ||
import software.amazon.smithy.model.Model; | ||
|
||
import static software.amazon.smithy.go.codegen.GoWriter.goTemplate; | ||
import static software.amazon.smithy.go.codegen.SymbolUtils.buildPackageSymbol; | ||
|
||
/** | ||
* Extends the base smithy Paginators integration to track in the User-Agent string. | ||
*/ | ||
public class AwsPaginators extends Paginators { | ||
@Override | ||
public Set<Symbol> getAdditionalClientOptions() { | ||
return Set.of(buildPackageSymbol("addIsPaginatorUserAgent")); | ||
} | ||
|
||
@Override | ||
public void writeAdditionalFiles(GoSettings settings, Model model, SymbolProvider symbolProvider, GoDelegator goDelegator) { | ||
super.writeAdditionalFiles(settings, model, symbolProvider, goDelegator); | ||
|
||
goDelegator.useFileWriter("api_client.go", settings.getModuleName(), goTemplate(""" | ||
func addIsPaginatorUserAgent(o *Options) { | ||
o.APIOptions = append(o.APIOptions, func(stack $stack:P) error { | ||
ua, err := getOrAddRequestUserAgent(stack) | ||
if err != nil { | ||
return err | ||
} | ||
ua.AddUserAgentFeature($featurePaginator:T) | ||
return nil | ||
}) | ||
}""", | ||
Map.of( | ||
"stack", SmithyGoDependency.SMITHY_MIDDLEWARE.struct("Stack"), | ||
"featurePaginator", AwsGoDependency.AWS_MIDDLEWARE.valueSymbol("UserAgentFeaturePaginator") | ||
))); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...codegen/src/main/java/software/amazon/smithy/aws/go/codegen/customization/AwsWaiters.java
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,63 @@ | ||
/* | ||
* Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://aws.amazon.com/apache2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
package software.amazon.smithy.aws.go.codegen.customization; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import software.amazon.smithy.aws.go.codegen.AwsGoDependency; | ||
import software.amazon.smithy.codegen.core.Symbol; | ||
import software.amazon.smithy.codegen.core.SymbolProvider; | ||
import software.amazon.smithy.go.codegen.GoDelegator; | ||
import software.amazon.smithy.go.codegen.GoSettings; | ||
import software.amazon.smithy.go.codegen.SmithyGoDependency; | ||
import software.amazon.smithy.go.codegen.integration.Waiters; | ||
import software.amazon.smithy.model.Model; | ||
|
||
import static software.amazon.smithy.go.codegen.GoWriter.goTemplate; | ||
import static software.amazon.smithy.go.codegen.SymbolUtils.buildPackageSymbol; | ||
|
||
/** | ||
* Extends the base smithy Waiters integration to track in the User-Agent string. | ||
*/ | ||
public class AwsWaiters extends Waiters { | ||
@Override | ||
public Set<Symbol> getAdditionalClientOptions() { | ||
return Set.of(buildPackageSymbol("addIsWaiterUserAgent")); | ||
} | ||
|
||
@Override | ||
public void writeAdditionalFiles(GoSettings settings, Model model, SymbolProvider symbolProvider, GoDelegator goDelegator) { | ||
super.writeAdditionalFiles(settings, model, symbolProvider, goDelegator); | ||
|
||
goDelegator.useFileWriter("api_client.go", settings.getModuleName(), goTemplate(""" | ||
func addIsWaiterUserAgent(o *Options) { | ||
o.APIOptions = append(o.APIOptions, func(stack $stack:P) error { | ||
ua, err := getOrAddRequestUserAgent(stack) | ||
if err != nil { | ||
return err | ||
} | ||
ua.AddUserAgentFeature($featureWaiter:T) | ||
return nil | ||
}) | ||
}""", | ||
Map.of( | ||
"stack", SmithyGoDependency.SMITHY_MIDDLEWARE.struct("Stack"), | ||
"featureWaiter", AwsGoDependency.AWS_MIDDLEWARE.valueSymbol("UserAgentFeatureWaiter") | ||
))); | ||
} | ||
} |
Oops, something went wrong.